[vlc-commits] decode_URI: simplify/relax non-encoded characters handling

Rémi Denis-Courmont git at videolan.org
Sun Jan 27 21:06:36 CET 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jan 27 22:03:39 2013 +0200| [485faf1b878195fd2967df02d075f460195b6e9e] | committer: Rémi Denis-Courmont

decode_URI: simplify/relax non-encoded characters handling

Since non-ASCII or non-printable characters are not supposed to occur
in URL, it does not matter much how they are dealt with.

The caller of decode_URI() can anyway not assume anything about the
decoded string. In particular, decode_URI() does not validate UTF-8
sequences in any case.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=485faf1b878195fd2967df02d075f460195b6e9e
---

 src/text/url.c |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/src/text/url.c b/src/text/url.c
index 9954bd8..f024acf 100644
--- a/src/text/url.c
+++ b/src/text/url.c
@@ -69,7 +69,7 @@ char *decode_URI (char *str)
     if (in == NULL)
         return NULL;
 
-    signed char c;
+    char c;
     while ((c = *(in++)) != '\0')
     {
         if (c == '%')
@@ -82,12 +82,7 @@ char *decode_URI (char *str)
             *(out++) = strtoul (hex, NULL, 0x10);
         }
         else
-        if (c >= 32)
             *(out++) = c;
-        else
-            /* Inserting non-ASCII or non-printable characters is unsafe,
-             * and no sane browser will send these unencoded */
-            *(out++) = '?';
     }
     *out = '\0';
     return str;



More information about the vlc-commits mailing list