mirror of
git://develop.git.wordpress.org/
synced 2025-06-02 00:34:58 +02:00
Asterisk is an allowed character in a URI and should not be stripped out by wp_sanitize_redirect().
fixes #28362. git-svn-id: https://develop.svn.wordpress.org/trunk@28939 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
ef5e962cfb
commit
92a7523362
@ -1160,7 +1160,7 @@ if ( !function_exists('wp_sanitize_redirect') ) :
|
||||
* @return string redirect-sanitized URL
|
||||
**/
|
||||
function wp_sanitize_redirect($location) {
|
||||
$location = preg_replace('|[^a-z0-9-~+_.?#=&;,/:%!]|i', '', $location);
|
||||
$location = preg_replace('|[^a-z0-9-~+_.?#=&;,/:%!*]|i', '', $location);
|
||||
$location = wp_kses_no_null($location);
|
||||
|
||||
// remove %0d and %0a from location
|
||||
|
@ -10,6 +10,7 @@ class Tests_Formatting_Redirect extends WP_UnitTestCase {
|
||||
$this->assertEquals('http://example.com/watchthelinefeedgo', wp_sanitize_redirect('http://example.com/watchthelinefeed%0ago'));
|
||||
$this->assertEquals('http://example.com/watchthecarriagereturngo', wp_sanitize_redirect('http://example.com/watchthecarriagereturn%0Dgo'));
|
||||
$this->assertEquals('http://example.com/watchthecarriagereturngo', wp_sanitize_redirect('http://example.com/watchthecarriagereturn%0dgo'));
|
||||
$this->assertEquals('http://example.com/watchtheallowedcharacters-~+_.?#=&;,/:%!*stay', wp_sanitize_redirect('http://example.com/watchtheallowedcharacters-~+_.?#=&;,/:%!*stay'));
|
||||
//Nesting checks
|
||||
$this->assertEquals('http://example.com/watchthecarriagereturngo', wp_sanitize_redirect('http://example.com/watchthecarriagereturn%0%0ddgo'));
|
||||
$this->assertEquals('http://example.com/watchthecarriagereturngo', wp_sanitize_redirect('http://example.com/watchthecarriagereturn%0%0DDgo'));
|
||||
|
Loading…
x
Reference in New Issue
Block a user