]> granicus.if.org Git - php/commitdiff
MFH: check for buflen (on FreeBSD _SC_GETGR_R_SIZE_MAX is not implemented)
authorAntony Dovgal <tony2001@php.net>
Thu, 22 Feb 2007 23:40:39 +0000 (23:40 +0000)
committerAntony Dovgal <tony2001@php.net>
Thu, 22 Feb 2007 23:40:39 +0000 (23:40 +0000)
patch by stas at FreeBSD dot org

ext/posix/posix.c

index 0c377842643993b5e3b87e6079cf54832665b8d8..35910e0f28d1ef682156c0371a44c323cc338645 100644 (file)
@@ -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);