From: Mathieu Desnoyers Date: Sat, 27 Oct 2012 15:08:07 +0000 (-0400) Subject: Fix: add missing header size validation X-Git-Tag: v1.0.0~4 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=b1ccd079a50e815eb1045ad80e4ab3400cfdc356 Fix: add missing header size validation Was causing infinite loop for tests/ctf-traces/fail/lttng-modules-2.0-pre1 failure test. Signed-off-by: Mathieu Desnoyers --- diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c index 8029512a..46f009d2 100644 --- a/formats/ctf/ctf.c +++ b/formats/ctf/ctf.c @@ -902,6 +902,9 @@ int ctf_open_trace_metadata_packet_read(struct ctf_trace *td, FILE *in, return -EINVAL; } + if ((header.content_size / CHAR_BIT) < header_sizeof(header)) + return -EINVAL; + toread = (header.content_size / CHAR_BIT) - header_sizeof(header); for (;;) {