Use offsets in FunctionIPv6StringToNum for copying ipv4 to buffer

This commit is contained in:
vdimir 2021-01-30 20:20:11 +03:00
parent 419c916612
commit 5cb99ae699
No known key found for this signature in database
GPG Key ID: F57B3E10A21DBB31
3 changed files with 5 additions and 2 deletions

View File

@ -311,7 +311,7 @@ public:
std::memcpy(
src_ipv4_buf + std::strlen("::ffff:"),
reinterpret_cast<const char *>(&vec_src[src_offset]),
std::strlen(reinterpret_cast<const char *>(&vec_src[src_offset])));
std::min(offsets_src[i] - src_offset, IPV4_MAX_TEXT_LENGTH + 1));
parseIPv6(src_ipv4_buf, reinterpret_cast<unsigned char *>(&vec_res[out_offset]));
}
else

View File

@ -62,3 +62,6 @@ FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF is ipv6 string: 1
::ffff:127.0.0.7
::ffff:127.0.0.8
::ffff:127.0.0.9
::ffff:127.0.0.10
::ffff:127.0.0.11
::ffff:127.0.0.12

View File

@ -89,4 +89,4 @@ SELECT '2001:0DB8:AC10:FE01:FEED:BABE:CAFE:F00D is ipv6 string: ', isIPv6String(
SELECT toIPv6('0.0.0.0');
SELECT toIPv6('127.0.0.1');
SELECT cutIPv6(IPv6StringToNum('127.0.0.1'), 0, 0);
SELECT toIPv6('127.0.0.' || toString(number)) FROM numbers(10);
SELECT toIPv6('127.0.0.' || toString(number)) FROM numbers(13);