]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug #1136: Internal DNS sometimes truncates host names in reverse (PTR)
authorserassio <>
Sun, 23 Jan 2005 19:39:45 +0000 (19:39 +0000)
committerserassio <>
Sun, 23 Jan 2005 19:39:45 +0000 (19:39 +0000)
lookups

Compressed hostnames was not dealt with proper, only saving the data of
the initial string + 2 bytes.

lib/rfc1035.c

index bad96e9c4c689edc88f52e78c438280f32441963..c07ddf654f033712b3eb7ddac94e7e249dfd8375 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: rfc1035.c,v 1.31 2004/04/11 09:15:11 hno Exp $
+ * $Id: rfc1035.c,v 1.32 2005/01/23 12:39:45 serassio Exp $
  *
  * Low level DNS protocol routines
  * AUTHOR: Duane Wessels
@@ -554,11 +554,10 @@ rfc1035AnswersUnpack(const char *buf,
            return -rfc1035_unpack_error;
        }
     }
-    i = (int) hdr.ancount;
-    if (i == 0)
+    if (hdr.ancount == 0)
        return 0;
-    recs = calloc(i, sizeof(*recs));
-    while (i--) {
+    recs = calloc((int)hdr.ancount, sizeof(*recs));
+    for (i = 0; i < (int)hdr.ancount; i++) {
        if (off >= sz) {        /* corrupt packet */
            RFC1035_UNPACK_DEBUG;
            break;