Sophie

Sophie

distrib > Mageia > 1 > i586 > media > core-updates-src > by-pkgid > ae7f89443cbf17e4b6a701eddbd46cdb > files > 6

squid-3.1.15-1.3.mga1.src.rpm


http://bugs.squid-cache.org/show_bug.cgi?id=3237
http://bugs.squid-cache.org/attachment.cgi?id=2514&action=diff&context=patch&collapsed=&headers=1&format=raw

diff -Naurp squid-3.1.15/lib/rfc1035.c squid-3.1.15.oden/lib/rfc1035.c
--- squid-3.1.15/lib/rfc1035.c	2011-08-28 07:53:14.000000000 +0000
+++ squid-3.1.15.oden/lib/rfc1035.c	2011-12-27 09:01:08.000000000 +0000
@@ -479,11 +479,11 @@ rfc1035SetErrno(int n)
 void
 rfc1035RRDestroy(rfc1035_rr ** rr, int n)
 {
-    if (*rr == NULL || n < 1) {
+    if (*rr == NULL) {
         return;
     }
 
-    while (n--) {
+    while (n-- > 0) {
         if ((*rr)[n].rdata)
             xfree((*rr)[n].rdata);
     }
diff -Naurp squid-3.1.15/src/dns_internal.cc squid-3.1.15.oden/src/dns_internal.cc
--- squid-3.1.15/src/dns_internal.cc	2011-08-28 07:53:14.000000000 +0000
+++ squid-3.1.15.oden/src/dns_internal.cc	2011-12-27 09:01:08.000000000 +0000
@@ -1126,16 +1126,17 @@ idnsGrokReply(const char *buf, size_t sz
         /* free the RR object without freeing its child strings (they are now taken by the copy above) */
         safe_free(message->answer);
 
-        message->answer = result;
-        message->ancount += q->initial_AAAA.count;
         n += q->initial_AAAA.count;
-        q->initial_AAAA.count=0;
+        q->initial_AAAA.count = 0;
+        message->answer = result;
+        message->ancount = n;
     } else if (q->initial_AAAA.count > 0 && n <= 0) {
         /* initial of dual queries was the only result set. */
         debugs(78, 6, HERE << "Merging DNS results " << q->name << " AAAA has " << q->initial_AAAA.count << " RR, A has " << n << " RR");
         rfc1035RRDestroy(&(message->answer), n);
         message->answer = q->initial_AAAA.answers;
         n = q->initial_AAAA.count;
+        message->ancount = n;
     }
     /* else initial results were empty. just use the final set as authoritative */