urlapi: treat 0 alone as decimal number in IPv4 address

Not as a broken octcal. Regression from b4538ec522

Extended test 1560 to verify this behavior.

Reported-by: Carlos Henrique Lima Melara

Closes #16652
This commit is contained in:
Daniel Stenberg 2025-03-10 13:42:42 +01:00
parent bad5e71331
commit 19d6415273
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
2 changed files with 35 additions and 3 deletions

View file

@ -578,9 +578,8 @@ static int ipv4_normalize(struct dynbuf *host)
int rc;
curl_off_t l;
if(*c == '0') {
c++;
if(*c == 'x') {
c++; /* skip the prefix */
if(c[1] == 'x') {
c += 2; /* skip the prefix */
rc = Curl_str_hex(&c, &l, UINT_MAX);
}
else