]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
check for bounds before accessing memory
authorAlan T. DeKok <aland@freeradius.org>
Thu, 14 Oct 2021 13:42:33 +0000 (09:42 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 14 Oct 2021 14:12:35 +0000 (10:12 -0400)
src/lib/util/inet.c

index 2c12f99de9bdd7f0426b0132d7449be4af15b81d..ab01f3eb1280d0d27e0e37769b347dd8e1006c8f 100644 (file)
@@ -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;