url: a zero-length userinfo part in the URL is still a (blank) user

Adjusted test 1560 to verify

Reported-by: Jay Satiro

Fixes #9088
Closes #9590
This commit is contained in:
Daniel Stenberg 2022-09-25 11:17:04 +02:00
parent 61c7ccab83
commit 1a87a1efba
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
2 changed files with 17 additions and 5 deletions

View file

@ -2912,15 +2912,15 @@ CURLcode Curl_parse_login_details(const char *login, const size_t len,
(psep && psep > osep ? (size_t)(psep - osep) :
(size_t)(login + len - osep)) - 1 : 0);
/* Allocate the user portion buffer */
if(userp && ulen) {
/* Allocate the user portion buffer, which can be zero length */
if(userp) {
ubuf = malloc(ulen + 1);
if(!ubuf)
result = CURLE_OUT_OF_MEMORY;
}
/* Allocate the password portion buffer */
if(!result && passwdp && plen) {
if(!result && passwdp && psep) {
pbuf = malloc(plen + 1);
if(!pbuf) {
free(ubuf);