1
0
mirror of https://github.com/moparisthebest/curl synced 2025-01-11 05:58:01 -05:00

url: reject too long input when parsing credentials

Since input passed to libcurl with CURLOPT_USERPWD and
CURLOPT_PROXYUSERPWD circumvents the regular string length check we have
in Curl_setstropt(), the input length limit is enforced in
Curl_parse_login_details too, separately.

Reported-by: Thomas Bouzerar
Closes #5383
This commit is contained in:
Daniel Stenberg 2020-05-13 00:52:34 +02:00
parent 3ff89286a9
commit e1f3f3a14f
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -2586,6 +2586,12 @@ CURLcode Curl_parse_login_details(const char *login, const size_t len,
size_t plen;
size_t olen;
/* the input length check is because this is called directcly from setopt
and isn't going through the regular string length check */
size_t llen = strlen(login);
if(llen > CURL_MAX_INPUT_LENGTH)
return CURLE_BAD_FUNCTION_ARGUMENT;
/* Attempt to find the password separator */
if(passwdp) {
psep = strchr(login, ':');