mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-19 03:33:43 +03:00
(main): Check for overflow in tabstop values
specified via the obsolete form. E.g., now this command fails: _POSIX2_VERSION=1 ./unexpand -$(echo '2^64+1'|bc) Before it would act like `_POSIX2_VERSION=1 ./unexpand -1'.
This commit is contained in:
1 parent
1377220ccf
commit
c2fed1cc19
1 file changed
+6
-1
+6
-1
@@ -518,7 +518,12 @@ main (int argc, char **argv)
|
||||
tabval = 0;
|
||||
have_tabval = true;
|
||||
}
|
||||
tabval = tabval * 10 + c - '0';
|
||||
{
|
||||
uintmax_t new_t = tabval * 10 + c - '0';
|
||||
if (UINTMAX_MAX / 10 < tabval || new_t < tabval * 10)
|
||||
error (EXIT_FAILURE, 0, _("tab stop value is too large"));
|
||||
tabval = new_t;
|
||||
}
|
||||
obsolete_tablist = true;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user