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

Collin Funk collin.funk1@gmail.com
Thu Aug 6 01:49:30 GMT 2026


Adhemerval Zanella <adhemerval.zanella@linaro.org> 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 <collin.funk1@gmail.com>

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


More information about the Libc-alpha mailing list