Skip to content

Commit a80fffa

Browse files
committed
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: Fix posix_getgrnam()/posix_getgrgid() crash on NULL group name
2 parents 41c0ffd + be55be0 commit a80fffa

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

ext/posix/posix.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,11 @@ static void php_posix_group_to_array(struct group *g, zval *array_group) /* {{{
690690
array_init(&array_members);
691691
zend_hash_real_init_packed(Z_ARRVAL(array_members));
692692

693-
add_assoc_string(array_group, "name", g->gr_name);
693+
if (g->gr_name) {
694+
add_assoc_string(array_group, "name", g->gr_name);
695+
} else {
696+
add_assoc_null(array_group, "name");
697+
}
694698
if (g->gr_passwd) {
695699
add_assoc_string(array_group, "passwd", g->gr_passwd);
696700
} else {

0 commit comments

Comments
 (0)