From: Alexander Ebert Date: Mon, 5 Aug 2013 00:20:46 +0000 (+0200) Subject: Fixed conversion of embedded IPv4 addresses X-Git-Tag: 2.0.0_Beta_7~62^2~6 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6e1b461c6e97c75c0ab5c28b95571b2a19ac308f;p=GitHub%2FWoltLab%2FWCF.git Fixed conversion of embedded IPv4 addresses --- 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)