com php-src: Fixed bug #72133 (php_posix_group_to_arr ay crashes if gr_passwd is NULL): NEWS ext/ posix/posix.c

From: Date: Sun, 01 May 2016 03:00:41 +0000
Subject: com php-src: Fixed bug #72133 (php_posix_group_to_arr ay crashes if gr_passwd is NULL): NEWS ext/ posix/posix.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-91982@lists.php.net to get a copy of this message
Commit: 895337ddbdeb322da3c583ef7ea03b45d0c8282c Author: Xinchen Hui <laruence@gmail.com> Sun, 1 May 2016 11:00:41 +0800 Parents: d0b952260e7c9794953268ccc34e1b3843b0be68 Branches: PHP-7.0 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=895337ddbdeb322da3c583ef7ea03b45d0c8282c Log: Fixed bug #72133 (php_posix_group_to_array crashes if gr_passwd is NULL) Bugs: https://bugs.php.net/72133 Changed paths: M NEWS M ext/posix/posix.c Diff: diff --git a/NEWS b/NEWS index 1df7cec..4a807c4 100644 --- a/NEWS +++ b/NEWS @@ -29,6 +29,10 @@ PHP NEWS . Fixed bug #72014 (Including a file with anonymous classes multiple times leads to fatal error). (Laruence) +- POSIX: + . Fixed bug #72133 (php_posix_group_to_array crashes if gr_passwd is NULL). + (esminis at esminis dot lt) + - Postgres: . Fixed bug #72028 (pg_query_params(): NULL converts to empty string). (Laruence) diff --git a/ext/posix/posix.c b/ext/posix/posix.c index e1f4ef6..25cb26f 100644 --- a/ext/posix/posix.c +++ b/ext/posix/posix.c @@ -987,8 +987,12 @@ int php_posix_group_to_array(struct group *g, zval *array_group) /* {{{ */ array_init(&array_members); add_assoc_string(array_group, "name", g->gr_name); - add_assoc_string(array_group, "passwd", g->gr_passwd); - for (count=0; g->gr_mem[count] != NULL; count++) { + if (array_group->gr_passwd) { + add_assoc_string(array_group, "passwd", g->gr_passwd); + } else { + add_assoc_null(array_group, "passwd"); + } + for (count = 0; g->gr_mem[count] != NULL; count++) { add_next_index_string(&array_members, g->gr_mem[count]); } zend_hash_str_update(Z_ARRVAL_P(array_group), "members", sizeof("members")-1, &array_members);

« previous php.cvs (#91982) next »