diff options
author | Daniel Stenberg <daniel@haxx.se> | 2020-06-24 15:23:19 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2020-06-24 15:23:19 +0200 |
commit | 95e4d470563516eb11e2e0d92b18d88a14fc587c (patch) | |
tree | c6b504d6cf3f0f3077e539b6caf23b7a7fab7982 | |
parent | 7fb33ee871a04d2e4f6ffedba0808635efb1ef53 (diff) | |
download | curl-95e4d470563516eb11e2e0d92b18d88a14fc587c.tar.gz |
escape: zero length input should return a zero length output
Regression added in 7.71.0.
Fixes #5601
Reported-by: Kristoffer Gleditsch
-rw-r--r-- | lib/escape.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/escape.c b/lib/escape.c index f3c558ed0..26d44df7b 100644 --- a/lib/escape.c +++ b/lib/escape.c @@ -89,6 +89,9 @@ char *curl_easy_escape(struct Curl_easy *data, const char *string, Curl_dyn_init(&d, CURL_MAX_INPUT_LENGTH); length = (inlength?(size_t)inlength:strlen(string)); + if(!length) + return strdup(""); + while(length--) { unsigned char in = *string; /* we need to treat the characters unsigned */ |