From: Antony Dovgal Date: Thu, 22 Feb 2007 23:40:25 +0000 (+0000) Subject: check for buflen (on FreeBSD _SC_GETGR_R_SIZE_MAX is not implemented) X-Git-Tag: RELEASE_1_0_1~181 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=65b54baac41e25492dcc3d4e35871bbb9c3755fa;p=php 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 35e9bda16f..97ec512366 100644 --- a/ext/posix/posix.c +++ b/ext/posix/posix.c @@ -885,6 +885,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);