mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
numfmt: avoid unlikely integer overflow
* src/numfmt.c (parse_format_string): Report overflow if pad < -LONG_MAX, since that can’t be negated.
This commit is contained in:
1 parent
ac2b4a43e6
commit
ba1ea8caee
1 file changed
+1
-1
+1
-1
@@ -1081,7 +1081,7 @@ parse_format_string (char const *fmt)
|
||||
|
||||
errno = 0;
|
||||
pad = strtol (fmt + i, &endptr, 10);
|
||||
if (errno == ERANGE)
|
||||
if (errno == ERANGE || pad < -LONG_MAX)
|
||||
die (EXIT_FAILURE, 0,
|
||||
_("invalid format %s (width overflow)"), quote (fmt));
|
||||
|
||||
|
||||
Reference in new issue
Block a user