[php-src] PR #22433: Fix posix_getgrnam()/posix_getgrgid() crash on NULL group name
| From: | iliaal | Date: | Wed, 24 Jun 2026 11:35:28 +0000 |
| Subject: | [php-src] PR #22433: Fix posix_getgrnam()/posix_getgrgid() crash on NULL group name | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-36599@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22433
Author: iliaal
php_posix_group_to_array() passed gr_name straight to add_assoc_string() with no NULL guard, so a
NULL group name segfaults via zend_string_init(), while the sibling gr_passwd field right below is
already guarded. glibc's files NSS backend normalizes empty fields to the empty string, but
third-party NSS modules (nss-systemd, nss-ldap, sssd and other directory backends) populate struct
group directly and may leave gr_name NULL. Guard it and emit null instead, matching the existing
gr_passwd handling. Companion to #22426, which guarded the equivalent fields in the passwd array.