From 33aaae1ca51f961133d86d686b62a00e80cb4def Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Date: Tue, 1 Mar 2022 09:09:04 -0500 Subject: [PATCH] Fix: lttng-ctl: uninitialized pointer read MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reported by Coverity: CID 1475822: Uninitialized pointer read (UNINIT) Using uninitialized value reply._fd_handles.array.size when calling lttng_payload_reset. Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau Change-Id: Ied7f5de61d736e8d8f9c869a36322262a4d79cd5 --- src/lib/lttng-ctl/lttng-ctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c index 089c9c1f8..012ba13b0 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -2416,14 +2416,14 @@ int lttng_list_events(struct lttng_handle *handle, (const char *) &lsm, 0, sizeof(lsm)); unsigned int nb_events = 0; + lttng_payload_init(&reply); + /* Safety check. An handle and channel name are mandatory. */ if (handle == NULL || channel_name == NULL) { ret = -LTTNG_ERR_INVALID; goto end; } - lttng_payload_init(&reply); - /* Initialize command parameters. */ lsm.cmd_type = LTTNG_LIST_EVENTS; ret = lttng_strncpy(lsm.session.name, handle->session_name, -- 2.34.1