chiark / gitweb /
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 59ccf547b39e6534af4e5381a4f0fdcc8cdc5348..acce334c08d992c0ae8a056c88de962b1eb183c0 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 59ccf547b39e6534af4e5381a4f0fdcc8cdc5348..acce334c08d992c0ae8a056c88de962b1eb183c0 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 09b63e68db84590aacbed3080b81d312c993c820..efad8134c9539f54215f4e55b74b0eded26ce87f 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 a20dd932d9b5cbd40299fb288f22086aecce13d1..257953fd1185d66f57e84ba2b45124ed912d401b 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 1d4dc5fd94df3753d7e9107a5630763482e6bf44..92bb2282a6265084ace73d820dd60c2db8018afa 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 2317954d9ea8fd779900d59bc990a66f5da3785a..cbb66a143eb27be6045d0ea9bf704223d3aa384b 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;
   }