Follow-up Comment #1, bug #67777 (group make): This is a duplicate of https://savannah.gnu.org/bugs/?65588.
Even though preallocating memory fixes the segmentation fault the behavior is
still incorrect
$ ls
makefile
$ cat makefile
.ONESHELL:
.SHELLFLAGS:=-c 'echo hello
all:;:
$ make
a = "/bin/sh"
a = "/bin/sh"
a = ""
a = "c 'echo hello"
a = ":"
:
/bin/sh: 2: Syntax error: "(" unexpected
make_bad_with_extra_memory_allocated: *** [makefile:3: all] Error 2
$
$
We can see here that argv is incorrect.
1. - is stripped from -c.
2. the first arg to the second /bin/sh is empty.
The result is a shell that exits with a wrong message about unexpected "(".
If we apply the patch from https://savannah.gnu.org/bugs/?65588.
$ ls
makefile
$ cat makefile
.ONESHELL:
.SHELLFLAGS:=-c 'echo hello
all:;:
$ make
"/bin/sh"
"-c"
"/bin/sh -c 'echo hello :"
:
/bin/sh: 1: Syntax error: Unterminated quoted string
make: *** [makefile:3: all] Error 2
$
We can see here that argv is correct and shell exits with the expected error
message about unterminated quoted string.
Unrelated to the buffer overflow, this argv passes /bin/sh through /bin/sh.
This may be a (benign?) bug of its own or it may be intentional.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?67777>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
