Strip control characters before validating redirect.

Merges [40183] to 3.7 branch.

Built from https://develop.svn.wordpress.org/branches/3.7@40194


git-svn-id: http://core.svn.wordpress.org/branches/3.7@40133 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Aaron Campbell 2017-03-06 13:47:09 +00:00
parent c6ab9f325b
commit 3e68b0c7d1
1 changed files with 1 additions and 1 deletions

View File

@ -972,7 +972,7 @@ if ( !function_exists('wp_validate_redirect') ) :
* @return string redirect-sanitized URL
**/
function wp_validate_redirect($location, $default = '') {
$location = trim( $location );
$location = trim( $location, " \t\n\r\0\x08\x0B" );
// browsers will assume 'http' is your protocol, and will obey a redirect to a URL starting with '//'
if ( substr($location, 0, 2) == '//' )
$location = 'http:' . $location;