summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2007-02-22 23:40:39 +0000
committerAntony Dovgal <tony2001@php.net>2007-02-22 23:40:39 +0000
commite0a7362646ddddc8e3fa9aa9c5b9547a7391dfec (patch)
tree2098c75c7310f6addbbea08f1dbba6bb77b7f53c
parente3d786be4e5d75aca1821955831209fd46dbe6eb (diff)
downloadphp-git-e0a7362646ddddc8e3fa9aa9c5b9547a7391dfec.tar.gz
MFH: check for buflen (on FreeBSD _SC_GETGR_R_SIZE_MAX is not implemented)
patch by stas at FreeBSD dot org
-rw-r--r--ext/posix/posix.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/posix/posix.c b/ext/posix/posix.c
index 0c37784264..35910e0f28 100644
--- a/ext/posix/posix.c
+++ b/ext/posix/posix.c
@@ -887,6 +887,10 @@ PHP_FUNCTION(posix_getgrgid)
#if defined(ZTS) && defined(HAVE_GETGRGID_R) && defined(_SC_GETGR_R_SIZE_MAX)
grbuflen = sysconf(_SC_GETGR_R_SIZE_MAX);
+ if (grbuflen < 1) {
+ RETURN_FALSE;
+ }
+
grbuf = emalloc(grbuflen);
ret = getgrgid_r(gid, &_g, grbuf, grbuflen, &retgrptr);