summaryrefslogtreecommitdiff
path: root/src/pr.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2005-04-03 13:12:53 +0000
committerJim Meyering <jim@meyering.net>2005-04-03 13:12:53 +0000
commitbb0eb686fcbb39619e2ca11819435ff5c8d92113 (patch)
treeff2df6736d8c37d30e1dae08d35a24f2d47af6e9 /src/pr.c
parent05613505e521a669d8bff1d701a29857112c6322 (diff)
downloadcoreutils-bb0eb686fcbb39619e2ca11819435ff5c8d92113.tar.xz
(main): Fix off-by-one error.
pr -$(perl -e 'print "0"x63 . 1') would write one byte beyond the end of a malloc'd buffer.
Diffstat (limited to 'src/pr.c')
-rw-r--r--src/pr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pr.c b/src/pr.c
index c5f5f28e6..886448b8c 100644
--- a/src/pr.c
+++ b/src/pr.c
@@ -892,7 +892,7 @@ main (int argc, char **argv)
if (ISDIGIT (c))
{
/* Accumulate column-count digits specified via old-style options. */
- if (n_digits == n_alloc)
+ if (n_digits + 1 >= n_alloc)
column_count_string
= x2nrealloc (column_count_string, &n_alloc,
sizeof *column_count_string);