mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
dbms: fix IPv6NumToString out of bounds access. [#METR-13151]
This commit is contained in:
parent
fcb5422dcf
commit
74b2f521d0
@ -88,9 +88,9 @@ public:
|
||||
auto begin = reinterpret_cast<char *>(&vec_res[0]);
|
||||
auto pos = begin;
|
||||
|
||||
for (size_t i = 0; i < vec_in.size(); i += ipv6_fixed_string_length)
|
||||
for (size_t offset = 0, i = 0; offset < vec_in.size(); offset += ipv6_fixed_string_length, ++i)
|
||||
{
|
||||
inet_ntop(AF_INET6, &vec_in[i], pos, INET6_ADDRSTRLEN);
|
||||
inet_ntop(AF_INET6, &vec_in[offset], pos, INET6_ADDRSTRLEN);
|
||||
pos = static_cast<char *>(memchr(pos, 0, INET6_ADDRSTRLEN)) + 1;
|
||||
offsets_res[i] = pos - begin;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user