From: Mathieu Desnoyers Date: Wed, 27 Nov 2013 09:26:53 +0000 (-0500) Subject: Fix: check packet index len X-Git-Tag: v1.2.0-rc1~39^2~9 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=a74d9cb2e7b76755f5c52652eb0879eacc2a564c Fix: check packet index len Found by coverity: ** CID 1132646: Untrusted value as argument (TAINTED_SCALAR) /formats/ctf/ctf.c: 1715 in import_stream_packet_inde) Signed-off-by: Mathieu Desnoyers --- diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c index 317457e8..278956b8 100644 --- a/formats/ctf/ctf.c +++ b/formats/ctf/ctf.c @@ -1716,6 +1716,11 @@ int import_stream_packet_index(struct ctf_trace *td, ret = -1; goto error; } + if (index_hdr.packet_index_len == 0) { + fprintf(stderr, "[error] Packet index length cannot be 0.\n"); + ret = -1; + goto error; + } while ((index_read = fread(&ctf_index, index_hdr.packet_index_len, 1, pos->index_fp)) == 1) {