From: Arran Cudbard-Bell Date: Thu, 8 Nov 2018 21:55:43 +0000 (-0500) Subject: Detect integer overflows when converting from strings X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6b5965c56e8a35401cedb76b34e3b681befa273e;p=thirdparty%2Ffreeradius-server.git Detect integer overflows when converting from strings --- diff --git a/src/lib/util/value.c b/src/lib/util/value.c index c81c1a91eec..c56d80d0427 100644 --- a/src/lib/util/value.c +++ b/src/lib/util/value.c @@ -3407,6 +3407,11 @@ static int fr_value_box_from_integer_str(fr_value_box_t *dst, fr_type_t dst_type return -1; } + if (errno == ERANGE) { + fr_strerror_printf("Integer value \"%s\" too large, would overflow", in); + + return -1; + } break; case FR_TYPE_INT8: @@ -3419,6 +3424,11 @@ static int fr_value_box_from_integer_str(fr_value_box_t *dst, fr_type_t dst_type return -1; } + if (errno == ERANGE) { + fr_strerror_printf("Integer value \"%s\" too large, would overflow", in); + + return -1; + } break; default: