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
This commit is contained in:
Daniel Stenberg 2024-08-01 16:42:58 +02:00
parent 8a9c22796b
commit 9bfc7f9234
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -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++;