Changeset 721c0e4


Ignore:
Timestamp:
07/03/07 14:52:06 (14 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
a43a2bd
Parents:
1344aa8
Message:

erf_read_packet no longer asserts on corrupt or truncated packets - it will now return a bad packet error instead

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_erf.c

    r4df814d r721c0e4  
    346346        size = rlen - dag_record_size;
    347347
    348         assert(size < LIBTRACE_PACKET_BUFSIZE);
     348        if (size >= LIBTRACE_PACKET_BUFSIZE) {
     349                trace_set_err(libtrace, TRACE_ERR_BAD_PACKET, "Packet size %u larger than supported by libtrace - packet is probably corrupt", size);
     350                return -1;
     351        }
    349352
    350353        /* Unknown/corrupt */
    351         assert(((dag_record_t *)packet->buffer)->type < 10);
     354        if (((dag_record_t *)packet->buffer)->type >= 10) {
     355                trace_set_err(libtrace, TRACE_ERR_BAD_PACKET, "Corrupt or Unknown ERF type");
     356                return -1;
     357        }
    352358       
    353359        /* read in the rest of the packet */
Note: See TracChangeset for help on using the changeset viewer.