From: Alan T. DeKok Date: Thu, 14 Oct 2021 13:42:33 +0000 (-0400) Subject: check for bounds before accessing memory X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=137d58d307c7565dcb12894125c2f2a112eaa135;p=thirdparty%2Ffreeradius-server.git check for bounds before accessing memory --- diff --git a/src/lib/util/inet.c b/src/lib/util/inet.c index 2c12f99de9b..ab01f3eb128 100644 --- a/src/lib/util/inet.c +++ b/src/lib/util/inet.c @@ -477,7 +477,7 @@ int fr_inet_pton4(fr_ipaddr_t *out, char const *value, ssize_t inlen, bool resol memset(out, 0, sizeof(*out)); end = value + inlen; - while (isspace((int) *value) && (value < end)) value++; + while ((value < end) && isspace((int) *value)) value++; if (value == end) { fr_strerror_const("Empty IPv4 address string is invalid"); return -1; @@ -614,7 +614,7 @@ int fr_inet_pton6(fr_ipaddr_t *out, char const *value, ssize_t inlen, bool resol memset(out, 0, sizeof(*out)); end = value + inlen; - while (isspace((int) *value) && (value < end)) value++; + while ((value < end) && isspace((int) *value)) value++; if (value == end) { fr_strerror_const("Empty IPv4 address string is invalid"); return -1; @@ -730,7 +730,7 @@ int fr_inet_pton(fr_ipaddr_t *out, char const *value, ssize_t inlen, int af, boo char const *end; end = value + inlen; - while (isspace((int) *value) && (value < end)) value++; + while ((value < end) && isspace((int) *value)) value++; if (value == end) { fr_strerror_const("Empty IPv4 address string is invalid"); return -1;