Re: [PATCH 4/6] posix: Use malloc instead of alloca for the glob brace expansion

Collin Funk <[email protected]> Wed, 05 Aug 2026 18:49:30 -0700
Newsgroups gmane.comp.lib.glibc.alpha
Message-ID <[email protected]>
Adhemerval Zanella <[email protected]> writes:

> The last alloca in __glob is the buffer holding one expansion of a
> brace expression.  As with the directory and user names, the stack it
> takes is not bounded by the call itself.
>
> Use malloc unconditionally.  __glob no longer uses alloca; glob_in_dir
> still does, so the accounting stays for now.
>
> Checked on x86_64-linux-gnu, aarch64-linux-gnu, and i686-linux-gnu.
> ---
>  posix/glob.c | 22 +++++++---------------
>  1 file changed, 7 insertions(+), 15 deletions(-)

This one looks good as well.

Reviewed-by: Collin Funk <[email protected]>

I'll review the other two patches tomorrow or Friday. Since they are a
bit more complicated, I want to make sure I have time to give them a
good look over.

Thanks,
Collin