From: wessels <> Date: Wed, 14 Apr 1999 12:38:03 +0000 (+0000) Subject: rfc1035AnswersUnpack would allocate an "array" of answers, even X-Git-Tag: SQUID_3_0_PRE1~2284 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=706d89bc3fcaaf904e94b0b566d7068d611781d3;p=thirdparty%2Fsquid.git rfc1035AnswersUnpack would allocate an "array" of answers, even if there were no answers in the reply, but there were other things in the reply like auth and additional. --- diff --git a/lib/rfc1035.c b/lib/rfc1035.c index 70ca2762f9..759a003757 100644 --- a/lib/rfc1035.c +++ b/lib/rfc1035.c @@ -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]);