diff options
author | Jim Meyering <jim@meyering.net> | 2005-01-08 12:00:54 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2005-01-08 12:00:54 +0000 |
commit | aa7f16bda693932de34b4a45fb5d00dad60a818b (patch) | |
tree | b479682bc688afaa5f09b8a28ad48b4252189d0a | |
parent | d4833923f761bc33fac458272c49dc346bdb3fc4 (diff) | |
download | coreutils-aa7f16bda693932de34b4a45fb5d00dad60a818b.tar.xz |
(main): Check for column count overflow with usages like "pr -2147483648".
-rw-r--r-- | src/pr.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -874,7 +874,10 @@ main (int argc, char **argv) { if (ISDIGIT (c)) { - accum = accum * 10 + c - '0'; + int new_c = accum * 10 + c - '0'; + if (INT_MAX / 10 < accum || new_c < 0) + error (EXIT_FAILURE, 0, _("column count too large")); + accum = new_c; columns = accum; explicit_columns = true; continue; |