1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-25 01:28:51 -05:00

escape: zero length input should return a zero length output

Regression added in 7.71.0.

Fixes #5601
Reported-by: Kristoffer Gleditsch
Closes #5602
This commit is contained in:
Daniel Stenberg 2020-06-24 15:23:19 +02:00
parent d2baa502fc
commit 32defc3197
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -89,6 +89,9 @@ char *curl_easy_escape(struct Curl_easy *data, const char *string,
Curl_dyn_init(&d, CURL_MAX_INPUT_LENGTH); Curl_dyn_init(&d, CURL_MAX_INPUT_LENGTH);
length = (inlength?(size_t)inlength:strlen(string)); length = (inlength?(size_t)inlength:strlen(string));
if(!length)
return strdup("");
while(length--) { while(length--) {
unsigned char in = *string; /* we need to treat the characters unsigned */ unsigned char in = *string; /* we need to treat the characters unsigned */