[lttng-dev] [PATCH lttng-tools] Fix: add element length check in lttng_index_file_open

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Thu Dec 15 11:13:19 UTC 2016


Handle cases where the index file header would contain a corrupted
value.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 src/common/index/index.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/common/index/index.c b/src/common/index/index.c
index ba69cdc..ecd4d45 100644
--- a/src/common/index/index.c
+++ b/src/common/index/index.c
@@ -246,6 +246,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;
-- 
2.1.4



More information about the lttng-dev mailing list