diff options
Diffstat (limited to 'lib/url.c')
-rw-r--r-- | lib/url.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -230,6 +230,21 @@ void Curl_safefree(void *ptr) free(ptr); } +/* Copy an upper case version of the string from src to dest. The + * strings may overlap. No more than n characters of the string are copied + * (including any NUL) and the destination string will NOT be + * NUL-terminated if that limit is reached. + */ +void Curl_strntoupper(char *dest, const char *src, size_t n) +{ + if (n < 1) + return; + + do { + *dest++ = Curl_raw_toupper(*src); + } while (*src++ && --n); +} + static void close_connections(struct SessionHandle *data) { /* Loop through all open connections and kill them one by one */ @@ -3441,8 +3456,7 @@ static char *detect_proxy(struct connectdata *conn) */ if(!prox && !Curl_raw_equal("http_proxy", proxy_env)) { /* There was no lowercase variable, try the uppercase version: */ - for(envp = proxy_env; *envp; envp++) - *envp = (char)toupper((int)*envp); + Curl_strntoupper(proxy_env, proxy_env, sizeof(proxy_env)); prox=curl_getenv(proxy_env); } |