From ffca890177bbf0980b66bc3a6d4d25c481957348 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Mon, 4 Sep 2017 17:07:16 -0300 Subject: posix: fix glob bugs with long login names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 39d1235c74..4c9334e839 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2017-09-08 Adhemerval Zanella + [BZ #1062] + * 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. + [BZ #1062] * posix/glob.c (glob): Port recent patches to platforms lacking getpwnam_r. -- cgit v1.2.3