[vlc-devel] [PATCH] url: remove size that doesn't even match the array

Rémi Denis-Courmont remi at remlab.net
Thu Jun 23 10:46:57 CEST 2016


Le 2016-06-22 08:42, Steve Lhomme a écrit :
> ---
>  src/text/url.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/text/url.c b/src/text/url.c
> index 27db5e7..7132463 100644
> --- a/src/text/url.c
> +++ b/src/text/url.c
> @@ -102,7 +102,7 @@ static char *encode_URI_bytes (const char *str,
> size_t *restrict lenp)
>      char *out = buf;
>      for (size_t i = 0; i < *lenp; i++)
>      {
> -        static const char hex[16] = "0123456789ABCDEF";
> +        static const char hex[] = "0123456789ABCDEF";

The C standard disagrees with you. hex[] was 16 bytes long, which was 
rather obviously the intended behaviour. This patch makes it 17 bytes 
for no reasons.

>          unsigned char c = str[i];
>
>          if (isurisafe (c))

-- 
Rémi Denis-Courmont
http://www.remlab.net/


More information about the vlc-devel mailing list