From: Daniel Stenberg Date: Thu, 1 Aug 2024 14:42:58 +0000 (+0200) Subject: escape: allow curl_easy_escape to generate 3*input length output X-Git-Tag: curl-8_10_0~445 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9bfc7f923479235b2fdf0e8fdd8468c0786a369b;p=thirdparty%2Fcurl.git escape: allow curl_easy_escape to generate 3*input length output Instead of capping it to the 3 * CURL_MAX_INPUT_LENGTH. To allow users to URL encode larger chunks of data. Closes #14339 --- diff --git a/lib/escape.c b/lib/escape.c index 1633c2da2b..9b6edb4433 100644 --- a/lib/escape.c +++ b/lib/escape.c @@ -63,12 +63,12 @@ char *curl_easy_escape(struct Curl_easy *data, const char *string, if(!string || (inlength < 0)) return NULL; - Curl_dyn_init(&d, CURL_MAX_INPUT_LENGTH * 3); - length = (inlength?(size_t)inlength:strlen(string)); if(!length) return strdup(""); + Curl_dyn_init(&d, length * 3 + 1); + while(length--) { /* treat the characters unsigned */ unsigned char in = (unsigned char)*string++;