diff --git a/lib/libc/gen/glob.c b/lib/libc/gen/glob.c index c4364407cdef..a36c522c4bdd 100644 --- a/lib/libc/gen/glob.c +++ b/lib/libc/gen/glob.c @@ -581,7 +581,8 @@ glob0(const Char *pattern, glob_t *pglob, struct glob_limit *limit, case STAR: pglob->gl_flags |= GLOB_MAGCHAR; /* collapse adjacent stars to one, - * to avoid exponential behavior + * to ensure "**" at the end continues to match the + * empty string */ if (bufnext == patbuf || bufnext[-1] != M_ALL) *bufnext++ = M_ALL;