From: Mathieu Desnoyers Date: Thu, 15 Dec 2016 11:13:19 +0000 (+0100) Subject: Fix: add element length check in lttng_index_file_open X-Git-Tag: v2.8.4~4 X-Git-Url: https://git.liburcu.org/?p=lttng-tools.git;a=commitdiff_plain;h=f0108ed540621afa523e1bf2e0374ee0c34be3a6 Fix: add element length check in lttng_index_file_open Handle cases where the index file header would contain a corrupted value. Signed-off-by: Mathieu Desnoyers Signed-off-by: Jérémie Galarneau --- diff --git a/src/common/index/index.c b/src/common/index/index.c index b5591d137..b481badb1 100644 --- a/src/common/index/index.c +++ b/src/common/index/index.c @@ -245,6 +245,10 @@ struct lttng_index_file *lttng_index_file_open(const char *path_name, ERR("Invalid header version"); goto error_close; } + if (element_len > sizeof(struct ctf_packet_index)) { + ERR("Index element length too long"); + goto error_close; + } index_file->fd = read_fd; index_file->major = major;