diff options
author | Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> | 2021-10-19 12:07:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-19 12:07:47 +0200 |
commit | fea3991ad168ee0a69a35c7be15e0732f2351d56 (patch) | |
tree | 6d3d75a811a609bca59562f1fc84c7c739c0f78b /src/lib/ndpi_utils.c | |
parent | 06f13fd2de45237b0643b2a26c76f57967b8e93e (diff) |
Fix some invalid memory reads (#1350)
`ndpi_detection_giveup()` (and any functions called by it) can't access
`ndpi_detection_module_struct->packet` anymore since 730c236.
Sync unit tests results
Close #1348
Diffstat (limited to 'src/lib/ndpi_utils.c')
-rw-r--r-- | src/lib/ndpi_utils.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/lib/ndpi_utils.c b/src/lib/ndpi_utils.c index 652107a19..c8206a066 100644 --- a/src/lib/ndpi_utils.c +++ b/src/lib/ndpi_utils.c @@ -2110,15 +2110,14 @@ static void ndpi_handle_risk_exceptions(struct ndpi_detection_module_struct *ndp } /* TODO: add IPv6 support */ - struct ndpi_packet_struct *packet = &ndpi_str->packet; if(!flow->ip_risk_mask_evaluated) { - if(packet->iph) { + if(flow->is_ipv6 == 0) { struct in_addr pin; - pin.s_addr = packet->iph->saddr; + pin.s_addr = flow->saddr; flow->risk_mask &= ndpi_host_ip_risk_ptree_match(ndpi_str, &pin); - pin.s_addr = packet->iph->daddr; + pin.s_addr = flow->daddr; flow->risk_mask &= ndpi_host_ip_risk_ptree_match(ndpi_str, &pin); } |