expand: Always quote caret when using fnmatch
commit8f9cca055bc661c4c690a5f5e1ca71370d129bc3
authorHerbert Xu <herbert@gondor.apana.org.au>
Wed, 19 Jan 2022 05:37:54 +0000 (19 16:37 +1100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 7 Dec 2022 08:27:49 +0000 (7 16:27 +0800)
tree1c58f5a1ed4bdeb8e790c7d70687d37dbebd51b0
parentdcf4ee38025a06e7392063f02f37afc0c08e0e2f
expand: Always quote caret when using fnmatch

This patch forces ^ to be a literal when we use fnmatch.

In order to allow for the extra space to quote the caret, the
function _rmescapes will allocate up to twice the memory if the
flag RMESCAPE_GLOB is set.

Fixes: 7638476c18f2 ("shell: Enable fnmatch/glob by default")
Reported-by: Christoph Anton Mitterer <calestyo@scientia.org>
Suggested-by: Harald van Dijk <harald@gigawatt.nl>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
src/expand.c
src/mystring.c
src/mystring.h