From a74d9cb2e7b76755f5c52652eb0879eacc2a564c Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 27 Nov 2013 04:26:53 -0500 Subject: [PATCH] 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 --- formats/ctf/ctf.c | 5 +++++ 1 file changed, 5 insertions(+) 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) { -- 2.34.1