File ipv6-hostnames-02.patch of Package perl-libwww-perl

From 941856b9ad022fafab9e0971aae1fa25a8b56dcc Mon Sep 17 00:00:00 2001
From: Jason Fesler <jfesler@gigo.com>
Date: Wed, 23 Jul 2014 22:38:59 -0700
Subject: [PATCH 2/2] Extra steps to make sure that the host address that has a
 ":" contains only characters appropriate for an IPv6 address.

---
 lib/LWP/Protocol/http.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/LWP/Protocol/http.pm b/lib/LWP/Protocol/http.pm
index 7ebdffc..7a739d3 100644
--- a/lib/LWP/Protocol/http.pm
+++ b/lib/LWP/Protocol/http.pm
@@ -18,8 +18,10 @@ sub _new_socket
     my($self, $host, $port, $timeout) = @_;
 
     # IPv6 literal IP address should be [bracketed] to remove
-    # ambiguity between ip address and port number
-    if ($host =~ /:/) {
+    # ambiguity between ip address and port number.
+    # Extra cautious to ensure that $host is _just_ an IPv6 address
+    # (at least as best as we can tell).
+    if ( ($host =~ /:/) && ($host =~ /^[0-9a-f:.]+$/i) ) {
       $host = "[$host]";
     }
 
openSUSE Build Service is sponsored by