ash: improve / fix glob expansion
authorFelix Fietkau <nbd@nbd.name>
Tue, 31 Jan 2017 20:58:55 +0000 (21:58 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Tue, 31 Jan 2017 20:58:55 +0000 (21:58 +0100)
commitb5b21126ca9217e1f721996cbef44c019185dd5d
tree1c8e640b4ea471ab7949863a9f07771a77a59e61
parentd6ace669737571c98977972b7392456f9e5156f6
ash: improve / fix glob expansion

When using musl libc glob() a very long string can cause glob() to fail,
which leads to an out of memory error being raised by ash.

This can happen easily if a very long quoted string contains *, even
though no glob expansion should ever be performed on it (since it's
quoted).

Fix this by properly parsing control characters and escaping and only
accept unquoted metacharacters. While we're at it, unify this check for
libc and built-in glob expansion

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/ash.c