Fix: check packet index len
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 27 Nov 2013 09:26:53 +0000 (04:26 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 27 Nov 2013 09:26:53 +0000 (04:26 -0500)
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 <mathieu.desnoyers@efficios.com>
formats/ctf/ctf.c

index 317457e883c5d7dab6271d3b5c430281e96ca987..278956b85e32a253af7491c8528b85712e643119 100644 (file)
@@ -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) {
This page took 0.024969 seconds and 4 git commands to generate.