Allow square brackets in a URL when it's sanitised for a redirect. Square brackets are valid in query parameters and IPv6 addresses.

Fixes #17052
Props voldemortensen


git-svn-id: https://develop.svn.wordpress.org/trunk@30683 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn
2014-12-01 03:15:24 +00:00
parent 095bfabfa9
commit b57c4ae165
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -1190,7 +1190,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