From b1ccd079a50e815eb1045ad80e4ab3400cfdc356 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Sat, 27 Oct 2012 11:08:07 -0400 Subject: [PATCH] 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 --- formats/ctf/ctf.c | 3 +++ 1 file changed, 3 insertions(+) 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 (;;) { -- 2.34.1