mirror of
https://github.com/adulau/ssldump.git
synced 2024-11-22 01:17:04 +00:00
Fix segfault by OOB read on malformed packets
This commit is contained in:
parent
4a0bbffc92
commit
cebce341c5
1 changed files with 6 additions and 0 deletions
|
@ -134,6 +134,12 @@ int network_process_packet(handler,timestamp,data,length)
|
|||
hlen=p.ip->ip_hl * 4;
|
||||
p.data += hlen;
|
||||
p.len = ntohs(p.ip->ip_len);
|
||||
|
||||
if(p.len > length) {
|
||||
printf("Malformed packet, size from IP header is larger than size reported by libpcap, skipping ...\n");
|
||||
return(0);
|
||||
}
|
||||
|
||||
if (p.len == 0) {
|
||||
DBG((0,"ip length reported as 0, presumed to be because of 'TCP segmentation offload' (TSO)\n"));
|
||||
p.len = p._len;
|
||||
|
|
Loading…
Reference in a new issue