1
mirror of https://code.videolan.org/videolan/vlc synced 2024-08-31 06:46:39 +02:00

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.
This commit is contained in:
Rémi Denis-Courmont 2013-01-27 22:03:39 +02:00
parent f71b33de23
commit 485faf1b87

View File

@ -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;