* (bug 4165) Correct validation for user language selection (data taint)
authorBrion Vibber <brion@users.mediawiki.org>
Sun, 4 Dec 2005 10:53:48 +0000 (10:53 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sun, 4 Dec 2005 10:53:48 +0000 (10:53 +0000)
RELEASE-NOTES
includes/Setup.php

index fb6e492..b13845e 100644 (file)
@@ -291,6 +291,7 @@ fully support the editing toolbar, but was found to be too confusing.
   patch by David Benbennick
 * (bug 4162) Add $wgThumbnailEpoch timestamp to force old thumbs to
   be rerendered on demand, sitewide
+* (bug 4165) Correct validation for user language selection (data taint)
 
 
 === Caveats ===
index adacede..efcbbc9 100644 (file)
@@ -217,7 +217,7 @@ $wgLanguageCode = $wgRequest->getText('uselang', '');
 if ($wgLanguageCode == '')
        $wgLanguageCode = $wgUser->getOption('language');
 # Validate $wgLanguageCode, which will soon be sent to an eval()
-if( empty( $wgLanguageCode ) || preg_match( '/^[^a-z-]*$/', $wgLanguageCode ) ) {
+if( empty( $wgLanguageCode ) || !preg_match( '/^[a-z]+(-[a-z]+)?$/', $wgLanguageCode ) ) {
        $wgLanguageCode = $wgContLanguageCode;
 }