diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-07-20 19:29:41 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-07-20 19:29:41 +0200 |
commit | f36caa4071bbb5bb6d098ced8116accc65370dd8 (patch) | |
tree | 8a3f24530056c38579a3cab42718d9fd5fa03124 /shell/hush.c | |
parent | 4c3c8a1a61e33a8c55991a260ba73d6a75d74810 (diff) | |
download | busybox-w32-f36caa4071bbb5bb6d098ced8116accc65370dd8.tar.gz busybox-w32-f36caa4071bbb5bb6d098ced8116accc65370dd8.tar.bz2 busybox-w32-f36caa4071bbb5bb6d098ced8116accc65370dd8.zip |
hush: never glob result of dquoted "${v:+/bin/c*}"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/hush.c')
-rw-r--r-- | shell/hush.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/shell/hush.c b/shell/hush.c index dddba5e30..4fdd15900 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -5994,7 +5994,19 @@ static int encode_then_append_var_plusminus(o_string *output, int n, | |||
5994 | continue; | 5994 | continue; |
5995 | } | 5995 | } |
5996 | #endif | 5996 | #endif |
5997 | o_addQchr(&dest, ch); | 5997 | if (dquoted) { |
5998 | /* Always glob-protect if in dquotes: | ||
5999 | * x=x; echo "${x:+/bin/c*}" - prints: /bin/c* | ||
6000 | * x=x; echo "${x:+"/bin/c*"}" - prints: /bin/c* | ||
6001 | */ | ||
6002 | o_addqchr(&dest, ch); | ||
6003 | } else { | ||
6004 | /* Glob-protect only if char is quoted: | ||
6005 | * x=x; echo ${x:+/bin/c*} - prints many filenames | ||
6006 | * x=x; echo ${x:+"/bin/c*"} - prints: /bin/c* | ||
6007 | */ | ||
6008 | o_addQchr(&dest, ch); | ||
6009 | } | ||
5998 | } /* for (;;) */ | 6010 | } /* for (;;) */ |
5999 | 6011 | ||
6000 | if (dest.data) { | 6012 | if (dest.data) { |