# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-CC=gcc $(WARNS) $(WERROR) $(OPTIMISE) $(DEBUG)
+CC=gcc $(WARNS) $(WERROR) $(OPTIMISE) $(DEBUG) $(XCFLAGS)
DEBUG=-g
OPTIMISE=-O2
WARNS= -Wall -Wmissing-prototypes -Wwrite-strings -Wstrict-prototypes \
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-CC=gcc $(WARNS) $(WERROR) $(OPTIMISE) $(DEBUG)
+CC=gcc $(WARNS) $(WERROR) $(OPTIMISE) $(DEBUG) $(XCFLAGS)
DEBUG=-g
OPTIMISE=-O2
WARNS= -Wall -Wmissing-prototypes -Wwrite-strings -Wstrict-prototypes \
int adns__vbuf_appendstr(vbuf *vb, const char *data) {
int l;
- l= strlen(data)+1;
+ l= strlen(data);
return adns__vbuf_append(vb,data,l);
}
const char *fmt, ...) PRINTFFORMAT(4,5);
int adns__vbuf_ensure(vbuf *vb, int want);
-int adns__vbuf_appendstr(vbuf *vb, const char *data);
+int adns__vbuf_appendstr(vbuf *vb, const char *data); /* does not include nul */
int adns__vbuf_append(vbuf *vb, const byte *data, int len);
/* 1=>success, 0=>realloc failed */
void adns__vbuf_appendq(vbuf *vb, const byte *data, int len);
}
void adns__reset_cnameonly(adns_query qu) {
- assert(qu->final_allocspace);
+ assert(!qu->final_allocspace);
qu->answer->nrrs= 0;
qu->answer->rrs= 0;
qu->interim_allocd= qu->answer->cname ? MEM_ROUND(strlen(qu->answer->cname)+1) : 0;
char *before, *after;
before= *strp;
+ if (!before) return;
l= strlen(before)+1;
after= adns__alloc_final(qu,l);
memcpy(after,before,l);
}
void adns__makefinal_block(adns_query qu, void **blpp, size_t sz) {
- void *after;
+ void *before, *after;
+ before= *blpp;
+ if (!before) return;
after= adns__alloc_final(qu,sz);
- memcpy(after,*blpp,sz);
+ memcpy(after,before,sz);
*blpp= after;
}
adns__diag(ads,serv,0,"received datagram too short for message header (%d)",dglen);
return;
}
+ cbyte= 0;
GET_W(cbyte,id);
GET_B(cbyte,f1);
GET_B(cbyte,f2);
flg_ra= f2&0x80;
rcode= (f1&0x0f);
- if (flg_qr) {
+ if (!flg_qr) {
adns__diag(ads,serv,0,"server sent us a query, not a response");
return;
}