From: Antony Dovgal Date: Thu, 22 Feb 2007 23:40:39 +0000 (+0000) Subject: MFH: check for buflen (on FreeBSD _SC_GETGR_R_SIZE_MAX is not implemented) X-Git-Tag: php-5.2.2RC1~319 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e0a7362646ddddc8e3fa9aa9c5b9547a7391dfec;p=php MFH: check for buflen (on FreeBSD _SC_GETGR_R_SIZE_MAX is not implemented) patch by stas at FreeBSD dot org --- 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);