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.11.0-rc1~30 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=de8218d45188782cd920e9871f759a54aee1b8cb;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 c8d60cddc..d8e2f1428 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -2744,6 +2744,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;