Bugfixes.
authorian <ian>
Sun, 8 Nov 1998 16:57:53 +0000 (16:57 +0000)
committerian <ian>
Sun, 8 Nov 1998 16:57:53 +0000 (16:57 +0000)
src/Makefile
src/Makefile.in
src/general.c
src/internal.h
src/query.c
src/reply.c

index 59ccf54..acce334 100644 (file)
@@ -14,7 +14,7 @@
 #  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 \
index 59ccf54..acce334 100644 (file)
@@ -14,7 +14,7 @@
 #  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 \
index 09b63e6..efad813 100644 (file)
@@ -125,7 +125,7 @@ int adns__vbuf_append(vbuf *vb, const byte *data, int len) {
 
 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);
 }
 
index a20dd93..257953f 100644 (file)
@@ -239,7 +239,7 @@ void adns__diag(adns_state ads, int serv, adns_query qu,
                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);
index 1d4dc5f..92bb228 100644 (file)
@@ -200,7 +200,7 @@ void *adns__alloc_final(adns_query qu, size_t sz) {
 }
 
 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;
@@ -242,6 +242,7 @@ void adns__makefinal_str(adns_query qu, char **strp) {
   char *before, *after;
 
   before= *strp;
+  if (!before) return;
   l= strlen(before)+1;
   after= adns__alloc_final(qu,l);
   memcpy(after,before,l);
@@ -249,10 +250,12 @@ void adns__makefinal_str(adns_query qu, char **strp) {
 }
 
 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;
 }
 
index 2317954..cbb66a1 100644 (file)
@@ -41,6 +41,7 @@ void adns__procdgram(adns_state ads, const byte *dgram, int dglen,
     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);
@@ -57,7 +58,7 @@ void adns__procdgram(adns_state ads, const byte *dgram, int dglen,
   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;
   }