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
..
2016-10-02 21:12:02 +02:00
2016-10-02 21:12:02 +02:00
2016-10-02 21:13:13 +02:00
2016-10-02 21:13:13 +02:00
2016-10-02 21:13:13 +02:00
2016-10-02 21:13:13 +02:00
2021-07-25 22:03:16 +02:00
2017-07-06 19:50:42 +02:00
2017-07-17 16:46:57 +02:00
2017-07-17 16:46:57 +02:00
2021-07-26 15:32:46 +02:00
2021-07-26 15:32:46 +02:00
2021-09-07 18:01:49 +02:00
2021-09-07 18:01:49 +02:00
2018-04-11 16:02:58 +02:00
2018-04-11 16:02:58 +02:00