Changeset 1370

Show
Ignore:
Timestamp:
14/10/08 10:03:46 (3 months ago)
Author:
perry
Message:

Be more aggressive in looking for bad packets.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/format_pcapfile.c

    r1334 r1370  
    273273                        sizeof(libtrace_pcapfile_pkt_hdr_t)); 
    274274 
     275        assert(swapl(libtrace,((libtrace_pcapfile_pkt_hdr_t*)packet->buffer)->caplen)<LIBTRACE_PACKET_BUFSIZE); 
     276 
    275277        if (err<0) { 
    276278                trace_set_err(libtrace,errno,"reading packet"); 
     
    367369        hdr.ts_usec = tv.tv_usec; 
    368370        hdr.caplen = trace_get_capture_length(packet); 
     371        assert(hdr.caplen < LIBTRACE_PACKET_BUFSIZE); 
    369372        /* PCAP doesn't include the FCS, we do */ 
    370373        if (linktype==TRACE_TYPE_ETH) 
     
    377380        else 
    378381                hdr.wirelen = trace_get_wire_length(packet); 
     382 
     383        assert(hdr.wirelen < LIBTRACE_PACKET_BUFSIZE); 
    379384 
    380385