From 9bfc7f923479235b2fdf0e8fdd8468c0786a369b Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 1 Aug 2024 16:42:58 +0200 Subject: [PATCH] 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 --- lib/escape.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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++; -- 2.47.3