monitor: Skip packet from PCAP file if it is truncated

This commit is contained in:
Marcel Holtmann 2014-08-12 00:40:07 -07:00
parent b00bea15ab
commit 581f00171d
1 changed files with 3 additions and 1 deletions

View File

@ -170,8 +170,10 @@ static int process_pcap(struct pcap *pcap)
continue;
}
if (len < real_len)
if (len < real_len) {
printf("Packet truncated from %u\n", real_len);
continue;
}
pkt_type = L_GET_UNALIGNED((const uint16_t *) buf);
pkt_type = L_BE16_TO_CPU(pkt_type);