From 485faf1b878195fd2967df02d075f460195b6e9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= Date: Sun, 27 Jan 2013 22:03:39 +0200 Subject: [PATCH] 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. --- 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 9954bd8a33..f024acfed5 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;