]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Detect integer overflows when converting from strings
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 8 Nov 2018 21:55:43 +0000 (16:55 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 8 Nov 2018 21:55:43 +0000 (16:55 -0500)
src/lib/util/value.c

index c81c1a91eec1f568bf7e0973d516dd4d543fa3a8..c56d80d0427f0058a173704b2468df33f636b7c1 100644 (file)
@@ -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: