Index: trunk/phase3/languages/Language.php |
— | — | @@ -156,7 +156,9 @@ |
157 | 157 | static $recursionLevel = 0; |
158 | 158 | |
159 | 159 | // Protect against path traversal below |
160 | | - if ( !Language::isValidCode( $code ) ) { |
| 160 | + if ( !Language::isValidCode( $code ) |
| 161 | + || strcspn( $code, "/\\\000" ) !== strlen( $code ) ) |
| 162 | + { |
161 | 163 | throw new MWException( "Invalid language code \"$code\"" ); |
162 | 164 | } |
163 | 165 | |
— | — | @@ -2856,7 +2858,9 @@ |
2857 | 2859 | */ |
2858 | 2860 | static function getFileName( $prefix = 'Language', $code, $suffix = '.php' ) { |
2859 | 2861 | // Protect against path traversal |
2860 | | - if ( !Language::isValidCode( $code ) ) { |
| 2862 | + if ( !Language::isValidCode( $code ) |
| 2863 | + || strcspn( $code, "/\\\000" ) !== strlen( $code ) ) |
| 2864 | + { |
2861 | 2865 | throw new MWException( "Invalid language code \"$code\"" ); |
2862 | 2866 | } |
2863 | 2867 | |