summaryrefslogtreecommitdiff
path: root/ext/com_dotnet/com_persist.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2006-09-16 18:10:32 +0000
committerIlia Alshanetsky <iliaa@php.net>2006-09-16 18:10:32 +0000
commit4c65e0e1cd4c4907b203c8dedaab726e162292db (patch)
tree5395c306a9ac707a3bdac936a8e87e24704cb005 /ext/com_dotnet/com_persist.c
parentbfc9cd7174155368c11e94f45c6e32e0e7ddb677 (diff)
downloadphp-git-4c65e0e1cd4c4907b203c8dedaab726e162292db.tar.gz
Added missing validation checks around expand_filepath()
Diffstat (limited to 'ext/com_dotnet/com_persist.c')
-rwxr-xr-xext/com_dotnet/com_persist.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/ext/com_dotnet/com_persist.c b/ext/com_dotnet/com_persist.c
index 8408d619d9..8738938f1f 100755
--- a/ext/com_dotnet/com_persist.c
+++ b/ext/com_dotnet/com_persist.c
@@ -390,15 +390,16 @@ CPH_METHOD(SaveToFile)
if (filename) {
fullpath = expand_filepath(filename, NULL TSRMLS_CC);
-
- if (PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
+ if (!fullpath) {
RETURN_FALSE;
}
-
- if (php_check_open_basedir(fullpath TSRMLS_CC)) {
+
+ if ((PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) ||
+ php_check_open_basedir(fullpath TSRMLS_CC)) {
+ efree(fullpath);
RETURN_FALSE;
}
-
+
olefilename = php_com_string_to_olestring(filename, strlen(fullpath), helper->codepage TSRMLS_CC);
efree(fullpath);
}
@@ -452,13 +453,13 @@ CPH_METHOD(LoadFromFile)
return;
}
- fullpath = expand_filepath(filename, NULL TSRMLS_CC);
-
- if (PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
+ if (!(fullpath = expand_filepath(filename, NULL TSRMLS_CC))) {
RETURN_FALSE;
}
- if (php_check_open_basedir(fullpath TSRMLS_CC)) {
+ if ((PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) ||
+ php_check_open_basedir(fullpath TSRMLS_CC)) {
+ efree(fullpath);
RETURN_FALSE;
}