rtld: check for overflow in parse_integer()
Reviewed by: dim, emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D56151
This commit is contained in:
@@ -6492,7 +6492,11 @@ parse_integer(const char *str)
|
||||
if (c < '0' || c > '9')
|
||||
return (-1);
|
||||
|
||||
if (n > INT_MAX / RADIX)
|
||||
return (-1);
|
||||
n *= RADIX;
|
||||
if (n > INT_MAX - (c - '0'))
|
||||
return (-1);
|
||||
n += c - '0';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user