Merge "Allow stop characters as quoted attribute delimiters"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 2 Sep 2015 13:27:37 +0000 (13:27 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 2 Sep 2015 13:27:37 +0000 (13:27 +0000)
1  2 
includes/Sanitizer.php

diff --combined includes/Sanitizer.php
@@@ -346,8 -346,8 +346,8 @@@ class Sanitizer 
                                  ($space*=$space*
                                        (?:
                                         # The attribute value: quoted or alone
-                                         \"([^<\"]*)\"
-                                        | '([^<']*)'
+                                         \"([^<\"]*)(?:\"|\$)
+                                        | '([^<']*)(?:'|\$)
                                         |  ([a-zA-Z0-9!#$%&()*,\\-.\\/:;<>?@[\\]^_`{|}~]+)
                                        )
                                )?(?=$space|\$)/sx";
                        $host = preg_replace( $strip, '', $host );
  
                        // IPv6 host names are bracketed with [].  Url-decode these.
 -                      if ( substr_compare( "//%5B", $host, 0, 5 ) === 0 && preg_match( '!^//%5B(.*?)%5D((:\d+)?)$!', $host, $matches ) ) {
 +                      if ( substr_compare( "//%5B", $host, 0, 5 ) === 0 && preg_match( '!^//%5B([0-9A-Fa-f:.]+)%5D((:\d+)?)$!', $host, $matches ) ) {
                                $host = '//[' . $matches[1] . ']' . $matches[2];
                        }