]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Another regression in %nn cleanup
authorHenrik Nordstrom <henrik@henriknordstrom.net>
Thu, 5 Nov 2009 08:06:19 +0000 (09:06 +0100)
committerHenrik Nordstrom <henrik@henriknordstrom.net>
Thu, 5 Nov 2009 08:06:19 +0000 (09:06 +0100)
lib/rfc1738.c

index a769e60eb649dc41bba73d641a1276fde2d091cd..bba0a5d6a7d9046d724f354089e0e307d3c10cd3 100644 (file)
@@ -202,14 +202,18 @@ rfc1738_unescape(char *s)
         } else {
             /* decode */
             char v1, v2;
+            int x;
             v1 = fromhex(s[j + 1]);
             if (v1 < 0)
                 continue;  /* non-hex or \0 */
             v2 = fromhex(s[j + 2]);
             if (v2 < 0)
                 continue;  /* non-hex or \0 */
-            s[i] = v1 << 4 | v2;
-            j += 2;
+            x = v1 << 4 | v2;
+            if (x > 0 && x <= 255) {
+                s[i] = x;
+                j += 2;
+            }
         }
     }
     s[i] = '\0';