mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-26 02:37:08 +00:00
Explicitly exit IPv4 parsing on a fatal error
This makes the function flow more readable. Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
This commit is contained in:
parent
6f400a376e
commit
9c9880a63f
@ -2684,7 +2684,7 @@ static int x509_inet_pton_ipv4(const char *src, void *dst)
|
|||||||
/* Don't allow leading zeroes. These might mean octal format,
|
/* Don't allow leading zeroes. These might mean octal format,
|
||||||
* which this implementation does not support. */
|
* which this implementation does not support. */
|
||||||
if (octet == 0 && num_digits > 0) {
|
if (octet == 0 && num_digits > 0) {
|
||||||
break;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
octet = octet * 10 + digit;
|
octet = octet * 10 + digit;
|
||||||
@ -2693,7 +2693,7 @@ static int x509_inet_pton_ipv4(const char *src, void *dst)
|
|||||||
} while (num_digits < 3);
|
} while (num_digits < 3);
|
||||||
|
|
||||||
if (octet >= 256 || num_digits > 3 || num_digits == 0) {
|
if (octet >= 256 || num_digits > 3 || num_digits == 0) {
|
||||||
break;
|
return -1;
|
||||||
}
|
}
|
||||||
*res++ = (uint8_t) octet;
|
*res++ = (uint8_t) octet;
|
||||||
num_octets++;
|
num_octets++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user