mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-11-07 12:48:33 -10:00
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:
1 parent
a1c042a964
commit
7cfffe25da
1 file changed
+4
@@ -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