diff options
author | Luca Deri <deri@ntop.org> | 2020-11-01 13:28:56 +0100 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2020-11-01 13:31:00 +0100 |
commit | b502bb08e06d58725d0382234300a7a773dbf0d0 (patch) | |
tree | 2b59a24fa45f105a75367a2c1dec0ef5e8231086 /src/lib | |
parent | 50ab34bfe68c51f80a78c49ea5dd18936f184c72 (diff) |
Fix for detecting numeric IPs
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/protocols/http.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/protocols/http.c b/src/lib/protocols/http.c index 48a3010f2..1a6b2f613 100644 --- a/src/lib/protocols/http.c +++ b/src/lib/protocols/http.c @@ -388,12 +388,15 @@ int http_process_user_agent(struct ndpi_detection_module_struct *ndpi_struct, static void ndpi_check_numeric_ip(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow, char *ip, u_int ip_len) { - char buf[22]; + char buf[22], *double_dot; struct in_addr ip_addr; strncpy(buf, ip, ip_len); buf[ip_len] = '\0'; + if((double_dot = strchr(buf, ':')) != NULL) + double_dot[0] = '\0'; + ip_addr.s_addr = inet_addr(buf); if(strcmp(inet_ntoa(ip_addr), buf) == 0) NDPI_SET_BIT(flow->risk, NDPI_HTTP_NUMERIC_IP_HOST); |