Handle endianness in x509_inet_pton_ipv6()

Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
This commit is contained in:
Glenn Strauss 2023-03-09 16:00:54 -05:00 committed by Andrzej Kurek
parent 7bd00e0708
commit b255e21e48

View file

@ -2579,7 +2579,7 @@ static int x509_inet_pton_ipv6(const char *src, void *dst)
; ;
} }
if (j != 0) { if (j != 0) {
addr[i++] = (x << 8) | (x >> 8); /* htons(x) */ addr[i++] = MBEDTLS_IS_BIG_ENDIAN ? x : (x << 8) | (x >> 8);
if (*v == '\0') { if (*v == '\0') {
break; break;
} else if (*v == '.' && (i != 0 || dc != -1) && (i < 7) && } else if (*v == '.' && (i != 0 || dc != -1) && (i < 7) &&