PluginProbe
Pods – Custom Content Types and Fields / 3.3.8
Pods – Custom Content Types and Fields v3.3.8
2.7.31.4 2.8.23.5 2.9.19.5 3.0.10.5 3.1.4.3 3.2.8.4 3.3.9.2 2.8.23.4 2.9.19.4 3.0.10.4 3.1.4.2 3.2.8.3 3.3.9.1 trunk 1.14.8 2.7.31.3 2.8.23.3 2.9.19.3 3.0.10.3 3.1.4.1 3.2.0 3.2.1 3.2.1.1 3.2.2 3.2.4 All 42 releases
← All changes | includes/data.php +5 -22 trunk3.3.8 View file →
@@ -2819,9 +2819,9 @@
2819 2819 $real_path = (string) realpath( $path );
2820 2820
2821 2821 $path_match = false;
2822 2822
2823 - foreach ( (array) $paths_to_check as $check_type ) {
2823 + foreach ( $paths_to_check as $check_type ) {
2824 2824 if ( ! isset( $available_checks[ $check_type ] ) ) {
2825 2825 continue;
2826 2826 }
2827 2827
@@ -2829,20 +2829,9 @@
2829 2829
2830 2830 $is_theme = 'theme' === $check_type;
2831 2831
2832 2832 foreach ( $check_type_paths as $path_to_check ) {
2833 - /*
2834 - * Separator-anchored prefix so a sibling directory whose name merely
2835 - * starts with the allowed path (e.g. ".../plugins/pods-evil" vs the
2836 - * "pods" root ".../plugins/pods") cannot satisfy the check.
2837 - */
2838 - $path_to_check_prefix = rtrim( $path_to_check, DIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR;
2839 -
2840 - if (
2841 - $real_path
2842 - && ( $real_path === $path_to_check || 0 === strpos( $real_path, $path_to_check_prefix ) )
2843 - && file_exists( $real_path )
2844 - ) {
2833 + if ( $real_path && 0 === strpos( $real_path, $path_to_check ) && file_exists( $real_path ) ) {
2845 2834 // Check the path starts with the one we are checking for and that the file exists.
2846 2835 $path_match = true;
2847 2836
2848 2837 $path = $real_path;
@@ -2851,19 +2840,13 @@
2851 2840 } elseif ( $is_theme ) {
2852 2841 // Check the theme directories.
2853 2842 $path_localized_for_theme = trim( $path, DIRECTORY_SEPARATOR );
2854 2843
2855 - // Resolve the candidate with realpath() and confirm it still lives inside the theme directory before accepting it, to help prevent security issues.
2856 - $theme_real_path = (string) realpath( $path_to_check . DIRECTORY_SEPARATOR . $path_localized_for_theme );
2857 -
2858 - if (
2859 - $theme_real_path
2860 - && 0 === strpos( $theme_real_path, $path_to_check_prefix )
2861 - && file_exists( $theme_real_path )
2862 - ) {
2844 + // Confirm the file exists.
2845 + if ( file_exists( $path_to_check . DIRECTORY_SEPARATOR . $path_localized_for_theme ) ) {
2863 2846 $path_match = true;
2864 2847
2865 - $path = $theme_real_path;
2848 + $path = $path_to_check . DIRECTORY_SEPARATOR . $path_localized_for_theme;
2866 2849
2867 2850 break;
2868 2851 }
2869 2852 }