Buggy code:
public class jnamed { Hashtable caches ; Hashtable znames ; Hashtable TSIGs ; public jnamed ( String conffile ) throws IOException { } public void addPrimaryZone ( String zname , String zonefile ) throws IOException { } public void addSecondaryZone ( String zone , String remote ) throws IOException { } public void addTSIG ( String name , String key ) { } public Cache getCache ( short dclass ) { } public Zone findBestZone ( Name name ) { } public RRset findExactMatch ( Name name , short type , short dclass , boolean glue ) { } void addRRset ( Name name , Message response , RRset rrset , byte section , boolean sigonly ) { } private void addSOA ( Message response , Zone zone ) { } private void addNS ( Message response , Zone zone ) { } private void addCacheNS ( Message response , Cache cache , Name name ) { } private void addGlue ( Message response , Name name ) { } private void addAdditional2 ( Message response , int section ) { } void addAdditional ( Message response ) { } byte addAnswer ( Message response , Name name , short type , short dclass , int iterations ) { } TSIG findTSIG ( Name name ) { } Message doAXFR ( Name name , Message query , Socket s ) { } Message generateReply ( Message query , byte [ ] in , Socket s ) { boolean badversion ; int maxLength ; boolean sigonly ; SetResponse sr ; if ( ( query . getHeader ( ) . getOpcode ( ) ) != ( Opcode . QUERY ) ) return errorMessage ( query , NOTIMPL ) ; Record queryRecord = query . getQuestion ( ) ; TSIGRecord queryTSIG = query . getTSIG ( ) ; TSIG tsig = null ; if ( queryTSIG != null ) { tsig = findTSIG ( queryTSIG . getName ( ) ) ; <START_BUG> if ( ! ( tsig . verify ( query , in , null ) ) ) <END_BUG> return formerrMessage ( in ) ; } OPTRecord queryOPT = query . getOPT ( ) ; if ( ( queryOPT != null ) && ( ( queryOPT . getVersion ( ) ) > 0 ) ) badversion = true ; if ( s != null ) maxLength = 65535 ; else if ( queryOPT != null ) maxLength = queryOPT . getPayloadSize ( ) ; else maxLength = 512 ; Message response = new Message ( ) ; response . getHeader ( ) . setID ( query . getHeader ( ) . getID ( ) ) ; response . getHeader ( ) . setFlag ( QR ) ; if ( query . getHeader ( ) . getFlag ( RD ) ) ; response . getHeader ( ) . setFlag ( RD ) ; response . addRecord ( queryRecord , QUESTION ) ; Name name = queryRecord . getName ( ) ; short type = queryRecord . getType ( ) ; short dclass = queryRecord . getDClass ( ) ; if ( ( type == ( AXFR ) ) && ( s != null ) ) return doAXFR ( name , query , s ) ; if ( ( ! ( Type . isRR ( type ) ) ) && ( type != ( ANY ) ) ) return errorMessage ( query , NOTIMPL ) ; byte rcode = addAnswer ( response , name , type , dclass , 0 ) ; if ( ( rcode != ( Rcode . NOERROR ) ) && ( rcode != ( Rcode . NXDOMAIN ) ) ) return errorMessage ( query , rcode ) ; addAdditional ( response ) ; if ( queryTSIG != null ) { try { if ( tsig != null ) tsig . apply ( response , queryTSIG ) ; } catch ( IOException e ) { } } try { response . freeze ( ) ; byte [ ] out = response . toWire ( ) ; if ( ( out . length ) > maxLength ) { response . thaw ( ) ; truncate ( response , out . length , maxLength ) ; if ( tsig != null ) tsig . apply ( response , queryTSIG ) ; } } catch ( IOException e ) { } return response ; } public int truncateSection ( Message in , int maxLength , int length , int section ) { } public void truncate ( Message in , int length , int maxLength ) { } public Message formerrMessage ( byte [ ] in ) { } public Message errorMessage ( Message query , short rcode ) { } public void serveTCP ( short port ) { } public void serveUDP ( short port ) { } public void addTCP ( final short port ) { } public void addUDP ( final short port ) { } public static void main ( String [ ] args ) { } }

Fix:
if ( ( tsig . verify ( query , in , null ) ) != ( Rcode . NOERROR ) )