[lttng-dev] [PATCH lttng-tools] Fix: add element length check in lttng_index_file_open
Jérémie Galarneau
jeremie.galarneau at efficios.com
Fri Dec 16 12:48:33 UTC 2016
Merged in master, stable-2.9 and stable-2.8.
Thanks!
Jérémie
On 15 December 2016 at 06:13, Mathieu Desnoyers
<mathieu.desnoyers at efficios.com> wrote:
> 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
>
--
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com
More information about the lttng-dev
mailing list