]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Allow recursive compression. Put a limit at 64 as "insane", to infinite
authorhno <>
Thu, 11 Apr 2002 03:16:17 +0000 (03:16 +0000)
committerhno <>
Thu, 11 Apr 2002 03:16:17 +0000 (03:16 +0000)
recursion.

This was causing problems at for example ftp.kde.org:

;; ANSWER SECTION:
ftp.kde.org.            1405    IN      CNAME   bolugftp.uni-bonn.de.
bolugftp.uni-bonn.de.   75221   IN      CNAME   subraum.rhrz.uni-bonn.de.
subraum.rhrz.uni-bonn.de. 75221 IN      A       131.220.60.97

Here subraum.rhrz.uni-bonn.de. is compressed using it's CNAME which is
compressed using the prior CNAME.

lib/rfc1035.c

index 7ef3f0f4990a1a5921049bc6ed8de1f36c0e8a5c..8fe084f54dbd466bbc567de07c72f730e2f0129e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: rfc1035.c,v 1.25 2002/03/29 05:49:23 wessels Exp $
+ * $Id: rfc1035.c,v 1.26 2002/04/10 21:16:17 hno Exp $
  *
  * Low level DNS protocol routines
  * AUTHOR: Duane Wessels
@@ -299,7 +299,7 @@ rfc1035HeaderUnpack(const char *buf, size_t sz, off_t * off, rfc1035_header * h)
  * Returns 0 (success) or 1 (error)
  */
 static int
-rfc1035NameUnpack(const char *buf, size_t sz, off_t * off, char *name, size_t ns, int rflag)
+rfc1035NameUnpack(const char *buf, size_t sz, off_t * off, char *name, size_t ns, int rdepth)
 {
     off_t no = 0;
     unsigned char c;
@@ -312,7 +312,7 @@ rfc1035NameUnpack(const char *buf, size_t sz, off_t * off, char *name, size_t ns
            /* blasted compression */
            unsigned short s;
            off_t ptr;
-           if (rflag)          /* pointer loop */
+           if (rdepth > 64)            /* infinite pointer loop */
                return 1;
            memcpy(&s, buf + (*off), sizeof(s));
            s = ntohs(s);
@@ -324,7 +324,7 @@ rfc1035NameUnpack(const char *buf, size_t sz, off_t * off, char *name, size_t ns
            /* Make sure the pointer is inside this message */
            if (ptr >= sz)
                return 1;
-           return rfc1035NameUnpack(buf, sz, &ptr, name + no, ns - no, rflag + 1);
+           return rfc1035NameUnpack(buf, sz, &ptr, name + no, ns - no, rdepth + 1);
        } else if (c > RFC1035_MAXLABELSZ) {
            /*
             * "(The 10 and 01 combinations are reserved for future use.)"