cvs: php-src(PHP_5_3) /ext/standard filestat.c

From: Date: Wed, 21 Nov 2007 11:30:29 +0000
Subject: cvs: php-src(PHP_5_3) /ext/standard filestat.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-47267@lists.php.net to get a copy of this message
jani Wed Nov 21 11:30:29 2007 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard filestat.c Log: MFH: fix crash bug in chown when 2nd parameter != string or int http://cvs.php.net/viewvc.cgi/php-src/ext/standard/filestat.c?r1=1.136.2.8.2.14.2.3&r2=1.136.2.8.2.14.2.4&diff_format=u Index: php-src/ext/standard/filestat.c diff -u php-src/ext/standard/filestat.c:1.136.2.8.2.14.2.3 php-src/ext/standard/filestat.c:1.136.2.8.2.14.2.4 --- php-src/ext/standard/filestat.c:1.136.2.8.2.14.2.3 Fri Nov 16 14:24:08 2007 +++ php-src/ext/standard/filestat.c Wed Nov 21 11:30:29 2007 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: filestat.c,v 1.136.2.8.2.14.2.3 2007/11/16 14:24:08 dmitry Exp $ */ +/* $Id: filestat.c,v 1.136.2.8.2.14.2.4 2007/11/21 11:30:29 jani Exp $ */ #include "php.h" #include "safe_mode.h" @@ -430,7 +430,7 @@ gid = gr->gr_gid; #endif } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "parameter 2 should be string or integer, %s given",zend_zval_type_name(group)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "parameter 2 should be string or integer, %s given", zend_zval_type_name(group)); RETURN_FALSE; } @@ -502,7 +502,7 @@ if (Z_TYPE_P(user) == IS_LONG) { uid = (uid_t)Z_LVAL_P(user); - } else { + } else if (Z_TYPE_P(user) == IS_STRING) { #if defined(ZTS) && defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWNAM_R) struct passwd pw; struct passwd *retpwptr = NULL; @@ -530,9 +530,12 @@ } uid = pw->pw_uid; #endif + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "parameter 2 should be string or integer, %s given", zend_zval_type_name(user)); + RETURN_FALSE; } - if (PG(safe_mode) &&(!php_checkuid(filename, NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) { + if (PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) { RETURN_FALSE; }

« previous php.cvs (#47267) next »