mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
Added target ownership check in function copy for safe_mode operations
This commit is contained in:
parent
6d41bf1492
commit
01ac20050e
2 changed files with 11 additions and 3 deletions
|
@ -2491,6 +2491,10 @@ PHP_FUNCTION(move_uploaded_file)
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (PG(safe_mode) &&(!php_checkuid(Z_STRVAL_PP(new_path), NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
|
||||||
|
RETURN_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
V_UNLINK(Z_STRVAL_PP(new_path));
|
V_UNLINK(Z_STRVAL_PP(new_path));
|
||||||
if (rename(Z_STRVAL_PP(path), Z_STRVAL_PP(new_path))==0) {
|
if (rename(Z_STRVAL_PP(path), Z_STRVAL_PP(new_path))==0) {
|
||||||
successful=1;
|
successful=1;
|
||||||
|
|
|
@ -1703,6 +1703,10 @@ PHP_FUNCTION(copy)
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (PG(safe_mode) &&(!php_checkuid((*target)->value.str.val, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
|
||||||
|
RETURN_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (php_copy_file(Z_STRVAL_PP(source), Z_STRVAL_PP(target))==SUCCESS) {
|
if (php_copy_file(Z_STRVAL_PP(source), Z_STRVAL_PP(target))==SUCCESS) {
|
||||||
RETURN_TRUE;
|
RETURN_TRUE;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue