You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pin->s_addr = ntohl(pin->s_addr); /* Make sure all in network byte order otherwise compares wont work */
This causes a segfault if packet is in read-only memory. Surely you should not be writing anything to the library consumer packet buffer? I.e. flow->packet.iph should be read-only at all times?
The text was updated successfully, but these errors were encountered:
@lucaderi I've send the pull request. That PR only addresses the invalid write to the packet ip header, it ensures that we do not pass flow->packet.iph->saddr or flow->packet.iph->saddr directly to ndpi_network_ptree_match where it will get written to. So the logic hasn't changed.
However, I think there is room for improvement which I could address in another pull request. I'll open a new issue for this.
In
ndpi_detection_process_packet
the packet parameter is defined asconst unsigned char *packet
:However on line https://github.com/ntop/nDPI/blob/dev/src/lib/ndpi_main.c#L3316 you cast this const away:
Which eventually gets use as a parameter to
ndpi_network_ptree_match
in line https://github.com/ntop/nDPI/blob/dev/src/lib/ndpi_main.c#L3423 :Inside
ndpi_network_ptree_match
you write to this memory https://github.com/ntop/nDPI/blob/dev/src/lib/ndpi_main.c#L1673:This causes a segfault if
packet
is in read-only memory. Surely you should not be writing anything to the library consumer packet buffer? I.e.flow->packet.iph
should be read-only at all times?The text was updated successfully, but these errors were encountered: