]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
rfc1035AnswersUnpack would allocate an "array" of answers, even
authorwessels <>
Wed, 14 Apr 1999 12:38:03 +0000 (12:38 +0000)
committerwessels <>
Wed, 14 Apr 1999 12:38:03 +0000 (12:38 +0000)
if there were no answers in the reply, but there were other things
in the reply like auth and additional.

lib/rfc1035.c

index 70ca2762f9dc418cd025086fed09e4d1d2a82451..759a003757f2b9bbcc84ece0bdf00dd163e70ecc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: rfc1035.c,v 1.3 1999/04/14 05:16:13 wessels Exp $
+ * $Id: rfc1035.c,v 1.4 1999/04/14 06:38:03 wessels Exp $
  *
  * Low level DNS protocol routines
  * AUTHOR: Duane Wessels
@@ -415,6 +415,8 @@ rfc1035AnswersUnpack(const char *buf,
        assert(off <= sz);
     }
     i = (int) hdr.ancount;
+    if (i == 0)
+       return 0;
     recs = calloc(i, sizeof(*recs));
     while (i--) {
        off = rfc1035RRUnpack(buf, sz, off, &recs[i]);