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.10.0-rc1~83 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=a3461e94de72e04fd6040c0fad5fb6d3615a2de4 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;