]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix potential buffer overread if input string exceeds bufferlen in fr_inet_pton4...
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 26 Jan 2019 15:40:26 +0000 (22:40 +0700)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 26 Jan 2019 15:40:26 +0000 (22:40 +0700)
src/lib/util/inet.c

index f582aea98f7ce21c31a394bbcc9fe1fc0c2a79c9..e5416d397a9a883641aea947bfbc22a0a3e800b8 100644 (file)
@@ -430,7 +430,7 @@ int fr_inet_pton4(fr_ipaddr_t *out, char const *value, ssize_t inlen, bool resol
         */
        if (inlen >= 0) {
                if (inlen >= (ssize_t)sizeof(buffer)) {
-                       fr_strerror_printf("Invalid IPv4 address string \"%s\"", value);
+                       fr_strerror_printf("Invalid IPv4 address string \"%pV\"", fr_box_strvalue_len(value, inlen));
                        return -1;
                }
                memcpy(buffer, value, inlen);
@@ -555,7 +555,7 @@ int fr_inet_pton6(fr_ipaddr_t *out, char const *value, ssize_t inlen, bool resol
         */
        if (inlen >= 0) {
                if (inlen >= (ssize_t)sizeof(buffer)) {
-                       fr_strerror_printf("Invalid IPv6 address string \"%s\"", value);
+                       fr_strerror_printf("Invalid IPv6 address string \"%pV\"", fr_box_strvalue_len(value, inlen));
                        return -1;
                }
                memcpy(buffer, value, inlen);