Skip to content

Commit 84fb4dd

Browse files
committed
Editor: Fix Path Traversal issue on Windows in Template-Part Block.
Merges [58470] to the 5.4 branch. Props xknown, jorbin. git-svn-id: https://develop.svn.wordpress.org/branches/5.4@58488 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 6b3fd18 commit 84fb4dd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/wp-includes/functions.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5296,6 +5296,9 @@ function iis7_supports_permalinks() {
52965296
* @return int 0 means nothing is wrong, greater than 0 means something was wrong.
52975297
*/
52985298
function validate_file( $file, $allowed_files = array() ) {
5299+
// Normalize path for Windows servers
5300+
$file = wp_normalize_path( $file );
5301+
52995302
// `../` on its own is not allowed:
53005303
if ( '../' === $file ) {
53015304
return 1;

0 commit comments

Comments
 (0)