use inet_pton to vefify ip address validity

master
Joseph Giovatto 6 years ago committed by Andre Puschmann
parent fa99aa590e
commit 056bfef996

@ -170,9 +170,9 @@ bool hss::read_db_file(std::string db_filename)
if (split[9] == std::string("dynamic")) {
ue_ctx->static_ip_addr = "0.0.0.0";
} else {
char buf[128];
if (inet_ntop(AF_INET, split[9].c_str(), buf, sizeof(buf))) {
if (m_ip_to_imsi.insert(std::make_pair(split[8], ue_ctx->imsi)).second) {
char buf[128] = {0};
if (inet_pton(AF_INET, split[9].c_str(), buf)) {
if (m_ip_to_imsi.insert(std::make_pair(split[9], ue_ctx->imsi)).second) {
ue_ctx->static_ip_addr = split[9];
m_hss_log->info("static ip addr %s\n", ue_ctx->static_ip_addr.c_str());
} else {

Loading…
Cancel
Save