cvs: php4(PHP_4_2_0) /ext/standard basic_functions.c
| From: | Rasmus Lerdorf | Date: | Sat, 11 May 2002 19:23:06 +0000 |
| Subject: | cvs: php4(PHP_4_2_0) /ext/standard basic_functions.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-11850@lists.php.net to get a copy of this message | ||
rasmus Sat May 11 15:23:06 2002 EDT
Modified files: (Branch: PHP_4_2_0)
/php4/ext/standard basic_functions.c
Log:
MFH - parse_ini_file() safe-mode fix
Index: php4/ext/standard/basic_functions.c
diff -u php4/ext/standard/basic_functions.c:1.447.2.3 php4/ext/standard/basic_functions.c:1.447.2.4
--- php4/ext/standard/basic_functions.c:1.447.2.3 Sat May 11 14:50:28 2002
+++ php4/ext/standard/basic_functions.c Sat May 11 15:23:05 2002
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.c,v 1.447.2.3 2002/05/11 18:50:28 rasmus Exp $ */
+/* $Id: basic_functions.c,v 1.447.2.4 2002/05/11 19:23:05 rasmus Exp $ */
#include "php.h"
#include "php_main.h"
@@ -2501,6 +2501,15 @@
}
convert_to_string_ex(filename);
+
+ if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_PP(filename), NULL,
CHECKUID_ALLOW_ONLY_FILE))) {
+ RETURN_FALSE;
+ }
+
+ if (php_check_open_basedir(Z_STRVAL_PP(filename) TSRMLS_CC)) {
+ RETURN_FALSE;
+ }
+
fh.handle.fp = VCWD_FOPEN(Z_STRVAL_PP(filename), "r");
if (!fh.handle.fp) {
php_error(E_WARNING, "Cannot open '%s' for reading", Z_STRVAL_PP(filename));