1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-29 17:31:02 +01:00

41662: exec -a arguments weren't sanitised

This commit is contained in:
Peter Stephenson 2017-09-10 18:02:52 +01:00
parent e44600d9aa
commit c9df6bc8d4
3 changed files with 17 additions and 0 deletions

View file

@ -1,3 +1,11 @@
2017-09-10 Peter Stephenson <p.w.stephenson@ntlworld.com>
* 41622: Src/exec., Test/A01grammar.ztst: exec -a arguments
weren't sanitised.
* 41661: Src/subst.c, Test/D04parameter.ztst: need to remove
tokens before passing to bufferwords() for (z).
2017-09-09 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
* 41628 (plus 41645 by Oliver): Completion/Unix/Command/_ps:

View file

@ -3007,6 +3007,9 @@ execcmd_exec(Estate state, Execcmd_params eparams,
}
if (exec_argv0) {
char *str, *s;
exec_argv0 = dupstring(exec_argv0);
remnulargs(exec_argv0);
untokenize(exec_argv0);
size_t sz = strlen(exec_argv0);
str = s = zalloc(5 + 1 + sz + 1);
strcpy(s, "ARGV0=");

View file

@ -103,6 +103,12 @@
0:`exec' with -a option, no space
>/bin/SPLOOSH
(exec -a foo* $ZTST_testdir/../Src/zsh -fc 'print -r -- ${(V)0}')
(exec -a "" $ZTST_testdir/../Src/zsh -fc 'print -r -- ${(V)0}')
0:rationalisation of arguments to exec -a
>foo*
>
(
opts=(-a /bin/WHOOOSH)
exec $opts /bin/sh -c 'echo $0'