X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=adns.git;a=blobdiff_plain;f=src%2Freply.c;h=0379ca441ff52f90feefdce6cf3dc333c7b808a7;hp=bd2d0e8efc6f99ec19a54a3d4641caaf31498550;hb=fcf2b4e1faf22accb6184cca595aaee602839868;hpb=72c6bfd77dfdb34457a792874fd1c3030fca90ac diff --git a/src/reply.c b/src/reply.c index bd2d0e8..0379ca4 100644 --- a/src/reply.c +++ b/src/reply.c @@ -35,7 +35,7 @@ void adns__procdgram(adns_state ads, const byte *dgram, int dglen, int flg_ra, flg_rd, flg_tc, flg_qr, opcode; int rrtype, rrclass, rdlength, rdstart; int anstart, nsstart; - int ownermatched, l, nrrs; + int ownermatched, l, nrrs, restartfrom; unsigned long ttl, soattl; const typeinfo *typei; adns_query qu, nqu; @@ -162,6 +162,7 @@ void adns__procdgram(adns_state ads, const byte *dgram, int dglen, * If it has any CNAMEs we stuff them in the answer. */ wantedrrs= 0; + restartfrom= -1; cbyte= anstart; for (rri= 0; rrianswer->type & adns_rrt_typemask)) { + if (restartfrom==-1) restartfrom= rri; wantedrrs++; } else { adns__debug(ads,serv,qu,"ignoring answer RR" @@ -331,12 +333,14 @@ void adns__procdgram(adns_state ads, const byte *dgram, int dglen, pai.arcount= arcount; pai.now= now; + assert(restartfrom>=0); for (rri=0, nrrs=0; rrianswer->type & adns_rrt_typemask) || !ownermatched) continue;