Skip to contentSkip to conversation

Fix: add element length check in lttng_index_file_open

PATCH Jérémie Galarneau 1 participant 1 message Dec 16, 2016 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Merged in master, stable-2.9 and stable-2.8.

Thanks!
Jérémie

Quoted 26 lines · Mathieu Desnoyers

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

---
 src/common/index/index.c | 4 ++++
 1 file changed, 4 insertions(+)
src/common/index/index.c +4 -1
index ba69cdc..ecd4d45 100644
@@ -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

Signature · 7 lines
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev