From: Arran Cudbard-Bell Date: Sat, 26 Jan 2019 15:40:26 +0000 (+0700) Subject: Fix potential buffer overread if input string exceeds bufferlen in fr_inet_pton4... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d91a005a11aaab04bf8450c176115efe366d1ebb;p=thirdparty%2Ffreeradius-server.git Fix potential buffer overread if input string exceeds bufferlen in fr_inet_pton4 and fr_inet_pton6 --- diff --git a/src/lib/util/inet.c b/src/lib/util/inet.c index f582aea98f7..e5416d397a9 100644 --- a/src/lib/util/inet.c +++ b/src/lib/util/inet.c @@ -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);