From 7aca7446352b30b2514b192a418588eb7fa5df05 Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Sat, 4 Mar 2017 13:54:11 -0500 Subject: [PATCH] URL encode non-ascii characters --- libretro-common/net/net_http.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libretro-common/net/net_http.c b/libretro-common/net/net_http.c index 96c93bb405..02d28f341a 100644 --- a/libretro-common/net/net_http.c +++ b/libretro-common/net/net_http.c @@ -105,8 +105,12 @@ void net_http_urlencode_full(char **dest, const char *source) { for (; *source; source++) { - if (urlencode_lut[(int)*source]) sprintf(enc, "%c", urlencode_lut[(int)*source]); - else sprintf(enc, "%%%02X", *source); + /* any non-ascii character will just be encoded without question */ + if ((int)*source < sizeof(urlencode_lut) && urlencode_lut[(int)*source]) + sprintf(enc, "%c", urlencode_lut[(int)*source]); + else + sprintf(enc, "%%%02X", *source); + while (*++(enc)); }