Strip control characters before validating redirect.
Merges [40183] to 4.4 branch. Built from https://develop.svn.wordpress.org/branches/4.4@40187 git-svn-id: http://core.svn.wordpress.org/branches/4.4@40126 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2235a5eae7
commit
442a4f4936
|
@ -1321,7 +1321,7 @@ if ( !function_exists('wp_validate_redirect') ) :
|
||||||
* @return string redirect-sanitized URL
|
* @return string redirect-sanitized URL
|
||||||
**/
|
**/
|
||||||
function wp_validate_redirect($location, $default = '') {
|
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 '//'
|
// browsers will assume 'http' is your protocol, and will obey a redirect to a URL starting with '//'
|
||||||
if ( substr($location, 0, 2) == '//' )
|
if ( substr($location, 0, 2) == '//' )
|
||||||
$location = 'http:' . $location;
|
$location = 'http:' . $location;
|
||||||
|
|
Loading…
Reference in New Issue