busybox/shell/hush_test
Sören Tempel fa52ac9781 ash: don't read past end of var in subvareval for bash substitutions
Without this patch, BusyBox handles bash pattern substitutions without
a terminating '/' character incorrectly.

Consider the following shell script:

	_bootstrapver=5.0.211-r0
	_referencesdir="/usr/${_bootstrapver/-*}/Sources"
	echo $_referencesdir

This should output `/usr/5.0.211/Sources`. However, without this patch
it instead outputs `/usr/5.0.211Sources`. This is due to the fact that
BusyBox expects the bash pattern substitutions to always be terminated
with a '/' (at least in this part of subvareval) and thus reads passed
the substitution itself and consumes the '/' character which is part of
the literal string. If there is no '/' after the substitution then
BusyBox might perform an out-of-bounds read under certain circumstances.

When replacing the bash pattern substitution with `${_bootstrapver/-*/}`,
or with this patch applied, ash outputs the correct value.

Signed-off-by: Sören Tempel <soeren@soeren-tempel.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-03-01 08:47:43 +01:00
..
hush-arith shell: fix parsing of $(( (v)++ + NUM )) 2021-09-26 13:29:25 +02:00
hush-bugs hush: document bugs in [[ =~ ]] comparison 2020-11-01 18:47:24 +01:00
hush-comm shell: fix script's comm field if ENABLE_FEATURE_PREFER_APPLETS=y 2021-10-11 18:44:00 +02:00
hush-getopts hush: fix "getopts" builtin to not be upset by other builtins calling getopt() 2017-08-29 13:38:30 +02:00
hush-glob ash: expand: Do not quote backslashes in unquoted parameter expansion 2018-08-07 18:58:02 +02:00
hush-heredoc hush: add "heredoc.tests" from ash, tweak ash "is a function" message 2018-07-24 17:10:18 +02:00
hush-invert
hush-leak
hush-misc hush: fix set -n to act immediately, not just after run_list() 2021-09-07 02:25:52 +02:00
hush-parsing hush: fix bkslash+newline handling and number validation in ${NN} and ${#NN} 2021-06-19 15:45:45 +02:00
hush-psubst shell: update psubst testcases 2021-07-27 04:20:32 +02:00
hush-quoting hush: implement $'str' bashism 2021-07-26 15:32:46 +02:00
hush-read shell: Fix "read -d ''" behavior 2020-07-31 18:42:30 +02:00
hush-redir hush: restore redirected stdin 2019-11-01 14:16:07 +01:00
hush-signals hush: output bash-compat killing signal names 2020-10-24 04:26:43 +02:00
hush-standalone ash: fix nofork bug where environment is not properly passed to a command 2017-11-03 14:16:25 +01:00
hush-test2 hush: document bugs in [[ =~ ]] comparison 2020-11-01 18:47:24 +01:00
hush-vars ash: don't read past end of var in subvareval for bash substitutions 2022-03-01 08:47:43 +01:00
hush-z_slow hush: improve ${var#...}, ${var:+...} and ${var/.../...} - handle quoting 2018-07-17 14:21:38 +02:00
.gitignore
run-all