]> git.ipfire.org Git - thirdparty/glibc.git/commit
posix: fix glob bugs with long login names
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 4 Sep 2017 20:07:16 +0000 (17:07 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 8 Sep 2017 14:33:39 +0000 (16:33 +0200)
commitffca890177bbf0980b66bc3a6d4d25c481957348
treed8089db57032126b04c27cee659c90e0eea7e995
parent5a79f97554af6f2eb0a654f844b3d1f56937064d
posix: fix glob bugs with long login names

Current glob implementation allows unlimited user name for home
directory construction on GLOB_TILDE case.  To accomplish it glob
either construct a name on stack if size are small enough (based
on current alloca_used) or in heap otherwise.

This patch simplifies storage allocation by using the same scratch
buffer for both get_rlogin_r and getpwnam_r.

This also syncs with gnulib commit 064df0b (glob: fix bugs with long
login names).

Checked on x86_64-linux-gnu and on a build using build-many-glibcs.py
for all major architectures.

* posix/glob.c (GET_LOGIN_NAME_MAX): Remove.
(glob): Use the same scratch buffer for both getlogin_r and
getpwnam_r.  Don’t require preallocation of the login name.  This
simplifies storage allocation, and corrects the handling of
long login names.
ChangeLog
posix/glob.c