Skip to content

Commit d95f070

Browse files
committed
Fix URL redirection issue in login_page.php
The fix for issue #17648 failed to correct all cases of redirection. Alejo Popovici discovered that the regex checking for URLs pointing to other domains considered an URL with a single '/' as local, allowing redirection e.g. to http:/google.com on certain browsers. Fixes #17997 (CVE-2014-6316)
1 parent 5571bcf commit d95f070

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

core/string_api.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,7 @@ function string_sanitize_url( $p_url, $p_return_absolute = false ) {
252252

253253
# Check for URL's pointing to other domains
254254
if ( 0 == $t_type || empty( $t_matches['script'] ) ||
255-
3 == $t_type && preg_match( '@(?:[^:]*)?://@', $t_url ) > 0 ) {
256-
255+
3 == $t_type && preg_match( '@(?:[^:]*)?:/*@', $t_url ) > 0 ) {
257256
return ( $p_return_absolute ? $t_path . '/' : '' ) . 'index.php';
258257
}
259258

0 commit comments

Comments
 (0)