]> git.ipfire.org Git - thirdparty/make.git/commit
[SV 66037] Avoid hang/crash from MAKEFLAGS=... on command line
authorDmitry Goncharov <dgoncharov@users.sf.net>
Sun, 4 Aug 2024 19:13:44 +0000 (15:13 -0400)
committerPaul Smith <psmith@gnu.org>
Sun, 4 Aug 2024 20:00:48 +0000 (16:00 -0400)
commit034f8623610a139010ee451d0ae81689c064209c
tree0a99b624557233263bb895b88160c66444e58f59
parent49b955a50d49aa07f5929b9b4aa54f3b5910e992
[SV 66037] Avoid hang/crash from MAKEFLAGS=... on command line

Make enters an infinite loop when some option and MAKEFLAGS=<value>
are specified on the command line.  For example,
    $ make -r MAKEFLAGS=hello=world

If decode_switches() runs handle_non_switch_argument() from within
the getopt() loop, it would recursively call decode_switches() to
enter a new getopt() loop, corrupting the state of the outer loop.

* src/main.c (decode_switches): Save up non-option arguments and run
handle_non_switch_argument() only after we're done with getopt().
* tests/scripts/variables/MAKEFLAGS: Add tests.
src/main.c
tests/scripts/variables/MAKEFLAGS