(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.
This commit is contained in:
Jim Meyering
2005-04-03 13:12:53 +00:00
parent 05613505e5
commit bb0eb686fc
+1 -1
View File
@@ -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);