Changeset 5460603 for lib


Ignore:
Timestamp:
01/14/19 17:30:49 (21 months ago)
Author:
Shane Alcock <salcock@…>
Branches:
develop
Children:
15f32cb
Parents:
6b7a958
Message:

Fix potential buffer overflow in pcapfile: reading code.

Fixes #97.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_pcapfile.c

    r6b7a958 r5460603  
    404404        bytes_to_read = swapl(libtrace,((libtrace_pcapfile_pkt_hdr_t*)packet->buffer)->caplen);
    405405
    406         if (bytes_to_read >= LIBTRACE_PACKET_BUFSIZE) {
     406        if (bytes_to_read >= (LIBTRACE_PACKET_BUFSIZE -
     407                        sizeof(libtrace_pcapfile_pkt_hdr_t))) {
    407408                trace_set_err(libtrace, TRACE_ERR_BAD_PACKET, "Invalid caplen in pcap header (%u) - trace may be corrupt", (uint32_t)bytes_to_read);
    408409                return -1;
Note: See TracChangeset for help on using the changeset viewer.