From: Jim Meyering Date: Sun, 3 Apr 2005 13:12:53 +0000 (+0000) Subject: (main): Fix off-by-one error. X-Git-Tag: CPPI-1_12~1130 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bb0eb686fcbb39619e2ca11819435ff5c8d92113;p=thirdparty%2Fcoreutils.git (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. --- 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);