diff options
author | Jb Audras <audrasjb@git.wordpress.org> | 2024-06-24 15:48:13 +0000 |
---|---|---|
committer | Jb Audras <audrasjb@git.wordpress.org> | 2024-06-24 15:48:13 +0000 |
commit | f41a771abdfeaab981e63745213e4444031565f5 (patch) | |
tree | 1ac743f0c8f3f6097c369692ccb4892b4b553eb6 | |
parent | 1c4a36c52b821f54db313ee3f1919d96496952cd (diff) | |
download | wordpress-f41a771abdfeaab981e63745213e4444031565f5.tar.gz wordpress-f41a771abdfeaab981e63745213e4444031565f5.zip |
Editor: Fix Path Traversal issue on Windows in Template-Part Block.
Merges [58470] to the 4.5 branch.
Props xknown, jorbin.
git-svn-id: https://develop.svn.wordpress.org/branches/4.5@58497 602fd350-edb4-49c9-b593-d223f7449a82
-rw-r--r-- | src/wp-includes/functions.php | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index 4dcfc81cf8..15da025118 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -4117,6 +4117,9 @@ function iis7_supports_permalinks() { * @return int 0 means nothing is wrong, greater than 0 means something was wrong. */ function validate_file( $file, $allowed_files = '' ) { + // Normalize path for Windows servers + $file = wp_normalize_path( $file ); + if ( false !== strpos( $file, '..' ) ) return 1; |