end++;
}
snprintf(trypath, MAXPATHLEN, "%s/%s", ptr, filename);
+
+ if (php_check_open_basedir(trypath TSRMLS_CC)) {
+ stream = NULL;
+ goto stream_done;
+ }
+
if (PG(safe_mode)) {
if (VCWD_STAT(trypath, &sb) == 0) {
/* file exists ... check permission */
-
- if (php_check_open_basedir(trypath TSRMLS_CC)) {
- stream = NULL;
- } else if ((php_check_safe_mode_include_dir(trypath TSRMLS_CC) == 0) ||
+ if ((php_check_safe_mode_include_dir(trypath TSRMLS_CC) == 0) ||
php_checkuid(trypath, mode, CHECKUID_CHECK_MODE_PARAM)) {
/* UID ok, or trypath is in safe_mode_include_dir */
stream = php_stream_fopen_rel(trypath, mode, opened_path, options);
} else {
stream = NULL;
}
-
- efree(pathbuf);
- return stream;
+ goto stream_done;
}
}
stream = php_stream_fopen_rel(trypath, mode, opened_path, options);
if (stream) {
+ stream_done:
efree(pathbuf);
return stream;
}