From: Jérémie Galarneau Date: Wed, 29 Aug 2018 21:06:48 +0000 (-0400) Subject: Fix: possible null dereference on communication error X-Git-Tag: v2.11.0-rc1~36 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=d9f484bc6f074842bc4ac3eab0127fe3aaa10909;hp=ff75c11e409c084f513046c7dd2071e4750081d9 Fix: possible null dereference on communication error lttng_ctl_ask_sessiond_fds_varlen() can return a positive error code and NULL buffers if the sessiond uses a command return code that is already negative. Signed-off-by: Jérémie Galarneau --- diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c index eff08df80..f503fd1cb 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -1959,6 +1959,11 @@ int lttng_list_events(struct lttng_handle *handle, goto end; } + if (!cmd_header) { + ret = -LTTNG_ERR_UNK; + goto end; + } + /* Set number of events and free command header */ nb_events = cmd_header->nb_events; if (nb_events > INT_MAX) {