]> sjero.net Git - wget/commitdiff
[svn] Don't unescape %00.
authorhniksic <devnull@localhost>
Thu, 5 May 2005 14:05:00 +0000 (07:05 -0700)
committerhniksic <devnull@localhost>
Thu, 5 May 2005 14:05:00 +0000 (07:05 -0700)
src/ChangeLog
src/url.c

index 25e41d947eaa35bea9ff61cbda3490263cca3c0e..1c444eb34af47ea725f9e29ac6de9e88441f53ec 100644 (file)
@@ -1,3 +1,8 @@
+2005-05-05  Hrvoje Niksic  <hniksic@xemacs.org>
+
+       * url.c (url_unescape): Don't unescape %00, it effectively
+       truncates the string.
+
 2005-05-05  Hrvoje Niksic  <hniksic@xemacs.org>
 
        * log.c (copy_and_escape): Replace the FOR_URI argument with a
index e89704d7b625ab21b6ea26b54270545235c2717a..f77d8ad9e9a8dbdd56891d7f70b7237adb9aea2d 100644 (file)
--- a/src/url.c
+++ b/src/url.c
@@ -175,10 +175,16 @@ url_unescape (char *s)
        }
       else
        {
+         char c;
          /* Do nothing if '%' is not followed by two hex digits. */
          if (!h[1] || !h[2] || !(ISXDIGIT (h[1]) && ISXDIGIT (h[2])))
            goto copychar;
-         *t = X2DIGITS_TO_NUM (h[1], h[2]);
+         c = X2DIGITS_TO_NUM (h[1], h[2]);
+         /* Don't unescape %00 because there is no way to insert it
+            into a C string without effectively truncating it. */
+         if (c == '\0')
+           goto copychar;
+         *t = c;
          h += 2;
        }
     }