-
Notifications
You must be signed in to change notification settings - Fork 179
Closed
Description
Dear clickhouse-cpp team,
The following function in clickhouse-cpp/clickhouse/columns/ip4.cpp is always thrown an exception, when ipv4 address is 255.255.255.255:
void ColumnIPv4::Append(const std::string& str) {
in_addr_t addr = inet_addr(str.c_str());
if (addr == INADDR_NONE) {
throw std::runtime_error("invalid IPv4 format, ip: " + str);
}
data_->Append(htonl(addr));
}
Because inet_addr function is obsolete, and this is a known issue. https://www.gnu.org/software/libc/manual/html_node/Host-Address-Functions.html
The possible solution is the following:
void ColumnIPv4::Append(const std::string& str) {
struct in_addr addr;
if (inet_aton(str.c_str(),&addr) == 0) {
throw std::runtime_error("invalid IPv4 format, ip: " + str);
}
data_->Append(htonl(addr.s_addr));
}
Please solve this problem.
Thank you and best regards,
BB
Metadata
Metadata
Assignees
Labels
No labels