From 6e1b461c6e97c75c0ab5c28b95571b2a19ac308f Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 5 Aug 2013 02:20:46 +0200 Subject: [PATCH] Fixed conversion of embedded IPv4 addresses --- wcfsetup/install/files/lib/util/UserUtil.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/util/UserUtil.class.php b/wcfsetup/install/files/lib/util/UserUtil.class.php index c05a05a31d..1c2892822d 100644 --- a/wcfsetup/install/files/lib/util/UserUtil.class.php +++ b/wcfsetup/install/files/lib/util/UserUtil.class.php @@ -143,6 +143,7 @@ final class UserUtil { $ipArray = array_pad(explode('.', $ip), 4, 0); $part7 = base_convert(($ipArray[0] * 256) + $ipArray[1], 10, 16); $part8 = base_convert(($ipArray[2] * 256) + $ipArray[3], 10, 16); + return '::ffff:'.$part7.':'.$part8; } @@ -167,7 +168,7 @@ final class UserUtil { // check if ip is a masked IPv4 address if (substr($ip, 0, 7) == '::ffff:') { $ip = substr($ip, 7); - if (preg_match('~^([a-f0-9]{4}):([a-f0-9]{4})$~', $ip, $matches)) { + if (preg_match('~^([a-f0-9]{1,4}):([a-f0-9]{1,4})$~', $ip, $matches)) { $ip = array( base_convert($matches[1], 16, 10), base_convert($matches[2], 16, 10) -- 2.20.1