Cscott has uploaded a new change for review.
https://gerrit.wikimedia.org/r/231567
Change subject: Validate IPv6 addresses in autolinks
......................................................................
Validate IPv6 addresses in autolinks
Change-Id: I126468e7ea8324bb173c92200b80d8fd0ab3f73d
---
M includes/parser/Parser.php
1 file changed, 10 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/67/231567/1
diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php
index 2eec08b..07c6b5c 100644
--- a/includes/parser/Parser.php
+++ b/includes/parser/Parser.php
@@ -1468,6 +1468,7 @@
*/
public function makeFreeExternalLink( $url, $numPostProto ) {
+ $numProto = strlen( $url ) - $numPostProto;
$trail = '';
# The characters '<' and '>' (which were escaped by
@@ -1511,6 +1512,15 @@
return $url . $trail;
}
+ # Validate IPv6 addresses
+ if ( $url[$numProto] == '[' ) {
+ $endbrack = strpos( $url, ']', $numProto ) ?: strlen(
$url );
+ $ipaddr = substr( $url, $numProto + 1, $endbrack -
$numProto - 1 );
+ if ( !IP::isValid( $ipaddr ) ) {
+ return $url . $trail;
+ }
+ }
+
$url = Sanitizer::cleanUrl( $url );
# Is this an external image?
--
To view, visit https://gerrit.wikimedia.org/r/231567
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I126468e7ea8324bb173c92200b80d8fd0ab3f73d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Cscott <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits