busybox/shell/ash_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
..
ash-alias ash: parser: Fix alias expansion after heredoc or newlines 2021-09-08 01:43:12 +02:00
ash-arith shell: fix parsing of $(( (v)++ + NUM )) 2021-09-26 13:29:25 +02:00
ash-comm shell: fix script's comm field if ENABLE_FEATURE_PREFER_APPLETS=y 2021-10-11 18:44:00 +02:00
ash-getopts
ash-glob
ash-heredoc ash: Expand here-documents in the current shell environment 2020-02-22 20:29:36 +01:00
ash-invert
ash-misc ash: LINENO starts from 0 in -c SCRIPT mode 2021-09-07 18:16:45 +02:00
ash-parsing ash: LINENO starts from 0 in -c SCRIPT mode 2021-09-07 18:16:45 +02:00
ash-psubst ash: LINENO starts from 0 in -c SCRIPT mode 2021-09-07 18:16:45 +02:00
ash-quoting ash: expand: Ensure result is escaped in cvtnum 2020-02-21 16:30:44 +01:00
ash-read shell: Fix "read -d ''" behavior 2020-07-31 18:42:30 +02:00
ash-redir ash: eval: Fail immediately with redirections errors for simple command 2020-02-20 09:36:51 +01:00
ash-signals hush: output bash-compat killing signal names 2020-10-24 04:26:43 +02:00
ash-standalone
ash-vars ash: don't read past end of var in subvareval for bash substitutions 2022-03-01 08:47:43 +01:00
ash-z_slow
.gitignore
printenv.c
recho.c
run-all shell/ash_test/run-all: unset locale/language variables 2021-09-07 18:24:08 +02:00
zecho.c