From: Jérémie Galarneau Date: Wed, 29 Aug 2018 21:25:04 +0000 (-0400) Subject: Fix: unchecked access to pids array X-Git-Tag: v2.10.6~43 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=66de3f4d3dc05e3bf5a1c59a47f0e3cacc2eee7e;p=lttng-tools.git Fix: unchecked access to pids array 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 f6fadcb6a..2d84aad90 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -2575,6 +2575,9 @@ int lttng_list_tracker_pids(struct lttng_handle *handle, return ret; } nr_pids = ret / sizeof(int32_t); + if (nr_pids > 0 && !pids) { + return -LTTNG_ERR_UNK; + } if (nr_pids == 1 && pids[0] == -1) { free(pids); pids = NULL;