mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-02-17 12:52:16 +02: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:
@@ -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