RSS Feed/News XF\Util\Ip::binaryToString breaks IPv6 addresses that contain a double colon

Status
Not open for further replies.

ENXF NET

Administrator
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P.S Member
S.V.I.P Member
V.I.P Member
Collaborate
Registered
Joined
Nov 13, 2018
Messages
28,767
Points
823

Reputation:

How to reproduce:
PHP:

var_dump(\XF\Util\Ip::binaryToString("*\x02\x124\x124\0\0\0\0\0\0\0\0\0\0", $shorten = false));

What should be returned:
string(39) "2a02:1234:1234:0000:0000:0000:0000:0000"

What is actually returned:
string(24) "2a02:1234:1234:0000:0000"

This is an invalid IPv6 address.

Possible fix (found at https://stackoverflow.com/a/58577916/444959):
Diff:

Code:
--- a/src/XF/Util/Ip.php
+++ b/src/XF/Util/Ip.php
@@ -37,13 +37,8 @@ class Ip

if (strlen($ip)...

Read more

Continue reading...
 
Status
Not open for further replies.
Top