shell/ash.c+4 -0
| @@ -7081,6 +7081,10 @@ subevalvar(char *start, char *str, int strloc, |
| *repl = '\0'; |
| break; |
| } |
| + | if ((unsigned char)*repl == CTLENDVAR) { /* ${v/pattern} (no trailing /, no repl) */ |
| + | repl = NULL; |
| + | break; |
| + | } |
| /* Handle escaped slashes, e.g. "${v/\//_}" (they are CTLESC'ed by this point) */ |
| if ((unsigned char)*repl == CTLESC && repl[1]) |
| repl++; |
shell/ash_test/ash-vars/var_bash_repl_unterminated.right+1 -0
shell/ash_test/ash-vars/var_bash_repl_unterminated.tests+2 -0
| @@ -0,0 +1,2 @@ |
| + | a=b-c |
| + | echo ${a/-*}/d |
shell/hush_test/hush-vars/var_bash_repl_unterminated.right+1 -0
shell/hush_test/hush-vars/var_bash_repl_unterminated.tests+2 -0
| @@ -0,0 +1,2 @@ |
| + | a=b-c |
| + | echo ${a/-*}/d |