diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2018-03-26 17:50:24 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2018-04-19 18:19:28 +0800 |
commit | 6900ff60ef7347a8c1445853a8f4689808e0976e (patch) | |
tree | 8078403d5e3f26ac8e593eaa79d9812b4df7dd3d | |
parent | expand: Fix buffer overflow in expandmeta (diff) | |
download | dash-6900ff60ef7347a8c1445853a8f4689808e0976e.tar.gz dash-6900ff60ef7347a8c1445853a8f4689808e0976e.zip |
expand: Fix glibc glob(3) support
It's been a while since we disabled glob(3) support by default. It appears to be working now, however, we have to change our code to detect the no-match case correctly. In particular, we need to test for GLOB_NOMAGIC | GLOB_NOCHECK instead of GLOB_MAGCHAR. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r-- | src/expand.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/expand.c b/src/expand.c index 30288db..ee077a7 100644 --- a/src/expand.c +++ b/src/expand.c @@ -1205,7 +1205,8 @@ expandmeta(str, flag) ckfree(p); switch (i) { case 0: - if (!(pglob.gl_flags & GLOB_MAGCHAR)) + if ((pglob.gl_flags & (GLOB_NOMAGIC | GLOB_NOCHECK)) == + (GLOB_NOMAGIC | GLOB_NOCHECK)) goto nometa2; addglob(&pglob); globfree(&pglob); |