Changeset c69aecb for lib/format_tsh.c


Ignore:
Timestamp:
09/30/14 15:17:06 (7 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, 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:
3c54095
Parents:
525d09d
Message:

Handle incomplete file reads in libtrace formats

Some file read function calls assumed that the full amount that was
asked for will be read from the file, which is not necessarily true
especially if the file was truncated.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_tsh.c

    rc909fad rc69aecb  
    147147                return 0;
    148148        }
     149
     150        if (numbytes < (int)sizeof(tsh_pkt_header_t)) {
     151                trace_set_err(libtrace, errno, "Incomplete TSH header");
     152                return -1;
     153        }
    149154
    150155        buffer2 = (char*)buffer2 + numbytes;
Note: See TracChangeset for help on using the changeset viewer.