Skip to content

Commit

Permalink
Editor: Fix Path Traversal issue on Windows in Template-Part Block.
Browse files Browse the repository at this point in the history
Merges [58470] to the 5.5 branch.
Props xknown, jorbin.




git-svn-id: https://develop.svn.wordpress.org/branches/5.5@58487 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
audrasjb committed Jun 24, 2024
1 parent 67ad1c6 commit eafc2dc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/wp-includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -5354,6 +5354,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 = array() ) {
// Normalize path for Windows servers
$file = wp_normalize_path( $file );

// `../` on its own is not allowed:
if ( '../' === $file ) {
return 1;
Expand Down

0 comments on commit eafc2dc

Please sign in to comment.