Skip to content

Commit a098454

Browse files
committed
Merge branch 'PHP-8.5'
* PHP-8.5: Fix posix_getgrnam()/posix_getgrgid() crash on NULL group name
2 parents 1132d02 + a80fffa commit a098454

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
@@ -688,7 +688,11 @@ static void php_posix_group_to_array(struct group *g, zval *array_group) /* {{{
688688
array_init(&array_members);
689689
zend_hash_real_init_packed(Z_ARRVAL(array_members));
690690

691-
add_assoc_string(array_group, "name", g->gr_name);
691+
if (g->gr_name) {
692+
add_assoc_string(array_group, "name", g->gr_name);
693+
} else {
694+
add_assoc_null(array_group, "name");
695+
}
692696
if (g->gr_passwd) {
693697
add_assoc_string(array_group, "passwd", g->gr_passwd);
694698
} else {

0 commit comments

Comments
 (0)