diff options
author | Daniel Stenberg <daniel@haxx.se> | 2020-06-24 15:23:19 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2020-06-25 00:00:28 +0200 |
commit | 32defc31970ddd0e5da14481b88f06428630bdb4 (patch) | |
tree | ce2b4e0d5adbd0467b24ca33b352809e55910c4f | |
parent | d2baa502fc7ea3f003db2d13b110f3f1da8d8073 (diff) | |
download | curl-32defc31970ddd0e5da14481b88f06428630bdb4.tar.gz |
escape: zero length input should return a zero length output
Regression added in 7.71.0.
Fixes #5601
Reported-by: Kristoffer Gleditsch
Closes #5602
-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 */ |