diff --git a/ext/posix/posix.c b/ext/posix/posix.c index c00b7465003b..fbc237e0e85c 100644 --- a/ext/posix/posix.c +++ b/ext/posix/posix.c @@ -1018,6 +1018,11 @@ PHP_FUNCTION(posix_getgrnam) RETURN_FALSE; } + /* getgrnam/_r() is buggy on Mac OSX 10.8, do early check for invalid empty name */ + if (name_len == 0) { + RETURN_FALSE; + } + #if defined(ZTS) && defined(HAVE_GETGRNAM_R) && defined(_SC_GETGR_R_SIZE_MAX) buflen = sysconf(_SC_GETGR_R_SIZE_MAX); if (buflen < 1) { @@ -1120,7 +1125,7 @@ int php_posix_passwd_to_array(struct passwd *pw, zval *return_value) /* {{{ */ } /* }}} */ -/* {{{ proto array posix_getpwnam(string groupname) +/* {{{ proto array posix_getpwnam(string username) User database access (POSIX.1, 9.2.2) */ PHP_FUNCTION(posix_getpwnam) { @@ -1137,6 +1142,11 @@ PHP_FUNCTION(posix_getpwnam) RETURN_FALSE; } + /* getpwnam/_r() is buggy on Mac OSX 10.8, do early check for invalid empty name */ + if (name_len == 0) { + RETURN_FALSE; + } + #if defined(ZTS) && defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWNAM_R) buflen = sysconf(_SC_GETPW_R_SIZE_MAX); if (buflen < 1) {