]> git.ipfire.org Git - thirdparty/make.git/commit
Check for recipe line count overflow before it overflows
authorPaul Smith <psmith@gnu.org>
Mon, 10 Oct 2022 00:17:18 +0000 (17:17 -0700)
committerPaul Smith <psmith@gnu.org>
Tue, 18 Oct 2022 18:20:44 +0000 (14:20 -0400)
commit9d24d4180188bf694635f09059003218e6e3c15a
tree8b24530bdd833b60d087943e2198c445981f3beb
parent2d943d3d2e5b69d6b635314a46d20e55cfbd255a
Check for recipe line count overflow before it overflows

awk 'BEGIN {
       print "x:"
       for (i = 0; i < 65536; i++)
         printf "\techo %d\n", i}
    ' | make -f -

Outputs only "make: 'x' is up to date."  Larger values run only the
lines above 65536.  Reported by Paul Eggert <eggert@cs.ucla.edu>.

* src/commands.c (chop_commands): Check the line count before it has
a chance to overflow.  Use size_t for max count so it can't overflow.
Remove stray 'd' in diagnostic.
src/commands.c