r14921 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r14920‎ | r14921 | r14922 >
Date:04:37, 23 June 2006
Author:tstarling
Status:old
Tags:
Comment:
Backported redirect validation fixes from HEAD
Modified paths:
  • /branches/REL1_6/phase3/includes/OutputPage.php (modified) (history)
  • /branches/REL1_6/phase3/includes/SpecialContributions.php (modified) (history)

Diff [purge]

Index: branches/REL1_6/phase3/includes/SpecialContributions.php
@@ -186,6 +186,7 @@
187187
188188 $nsurl = $xnsurl = '';
189189 if (($ns = $wgRequest->getVal('namespace', null)) !== null && $ns !== '') {
 190+ $ns = intval( $ns );
190191 $nsurl = '&namespace='.$ns;
191192 $xnsurl = htmlspecialchars($nsurl);
192193 $finder->set_namespace($ns);
Index: branches/REL1_6/phase3/includes/OutputPage.php
@@ -55,7 +55,12 @@
5656 }
5757
5858 function addHeader( $name, $val ) { array_push( $this->mHeaders, $name.': '.$val ) ; }
59 - function redirect( $url, $responsecode = '302' ) { $this->mRedirect = $url; $this->mRedirectCode = $responsecode; }
 59+
 60+ function redirect( $url, $responsecode = '302' ) {
 61+ # Strip newlines as a paranoia check for header injection in PHP<5.1.2
 62+ $this->mRedirect = str_replace( "\n", '', $url );
 63+ $this->mRedirectCode = $responsecode;
 64+ }
6065 function setStatusCode( $statusCode ) { $this->mStatusCode = $statusCode; }
6166
6267 # To add an http-equiv meta tag, precede the name with "http:"

Status & tagging log