From bb0eb686fcbb39619e2ca11819435ff5c8d92113 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 3 Apr 2005 13:12:53 +0000 Subject: [PATCH] (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. --- src/pr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pr.c b/src/pr.c index c5f5f28e61..886448b8c1 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); -- 2.47.3