mirror of
https://github.com/curl/curl.git
synced 2025-02-17 14:59:45 +08:00
urlapi: urlencode characters above 0x7f correctly
fixes #3741 Closes #3742
This commit is contained in:
parent
64cbae3107
commit
0dd47c2a3d
@ -1273,7 +1273,7 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what,
|
|||||||
size_t nalloc = strlen(part);
|
size_t nalloc = strlen(part);
|
||||||
|
|
||||||
if(urlencode) {
|
if(urlencode) {
|
||||||
const char *i;
|
const unsigned char *i;
|
||||||
char *o;
|
char *o;
|
||||||
bool free_part = FALSE;
|
bool free_part = FALSE;
|
||||||
char *enc = malloc(nalloc * 3 + 1); /* for worst case! */
|
char *enc = malloc(nalloc * 3 + 1); /* for worst case! */
|
||||||
@ -1281,7 +1281,7 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what,
|
|||||||
return CURLUE_OUT_OF_MEMORY;
|
return CURLUE_OUT_OF_MEMORY;
|
||||||
if(plusencode) {
|
if(plusencode) {
|
||||||
/* space to plus */
|
/* space to plus */
|
||||||
i = part;
|
i = (const unsigned char *)part;
|
||||||
for(o = enc; *i; ++o, ++i)
|
for(o = enc; *i; ++o, ++i)
|
||||||
*o = (*i == ' ') ? '+' : *i;
|
*o = (*i == ' ') ? '+' : *i;
|
||||||
*o = 0; /* zero terminate */
|
*o = 0; /* zero terminate */
|
||||||
@ -1292,7 +1292,7 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what,
|
|||||||
}
|
}
|
||||||
free_part = TRUE;
|
free_part = TRUE;
|
||||||
}
|
}
|
||||||
for(i = part, o = enc; *i; i++) {
|
for(i = (const unsigned char *)part, o = enc; *i; i++) {
|
||||||
if(Curl_isunreserved(*i) ||
|
if(Curl_isunreserved(*i) ||
|
||||||
((*i == '/') && urlskipslash) ||
|
((*i == '/') && urlskipslash) ||
|
||||||
((*i == '=') && equalsencode) ||
|
((*i == '=') && equalsencode) ||
|
||||||
|
Loading…
Reference in New Issue
Block a user