cvs: php4 /main fopen-wrappers.c
| From: | Andi Gutmans | Date: | Thu, 14 Sep 2000 20:47:35 +0000 |
| Subject: | cvs: php4 /main fopen-wrappers.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-1759@lists.php.net to get a copy of this message | ||
andi Thu Sep 14 13:47:35 2000 EDT
Modified files:
/php4/main fopen-wrappers.c
Log:
- Use IS_ABSOLUTE_PATH() so that this will work correctly under Windows
Index: php4/main/fopen-wrappers.c
diff -u php4/main/fopen-wrappers.c:1.90 php4/main/fopen-wrappers.c:1.91
--- php4/main/fopen-wrappers.c:1.90 Sat Sep 9 14:29:37 2000
+++ php4/main/fopen-wrappers.c Thu Sep 14 13:47:35 2000
@@ -16,7 +16,7 @@
| Jim Winstead <jimw@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: fopen-wrappers.c,v 1.90 2000/09/09 21:29:37 venaas Exp $ */
+/* $Id: fopen-wrappers.c,v 1.91 2000/09/14 20:47:35 andi Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -390,6 +390,7 @@
char trypath[MAXPATHLEN + 1];
struct stat sb;
FILE *fp;
+ int filename_length;
PLS_FETCH();
if (opened_path) {
@@ -403,12 +404,10 @@
}
return php_fopen_and_set_opened_path(filename, mode, opened_path);
}
+
+ filename_length = strlen(filename);
/* Absolute path open - prepend document_root in safe mode */
-#ifdef PHP_WIN32
- if (IS_SLASH(*filename) || (filename[1] == ':')) {
-#else
- if (IS_SLASH(*filename)) {
-#endif
+ if (IS_ABSOLUTE_PATH(filename, filename_length)) {
if (PG(safe_mode) && PG(doc_root)) {
snprintf(trypath, MAXPATHLEN, "%s%s", PG(doc_root), filename);
if (!php_checkuid(trypath, mode, 0)) {