Fix: lttng-ctl: uninitialized pointer read
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Tue, 1 Mar 2022 14:09:04 +0000 (09:09 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 1 Mar 2022 19:12:09 +0000 (14:12 -0500)
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 <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ied7f5de61d736e8d8f9c869a36322262a4d79cd5

src/lib/lttng-ctl/lttng-ctl.cpp

index c7fb313f90fb1eedfa0541b1014d8209473fd23e..f99ce672c96db6fea7088b01cc63af7dd305c473 100644 (file)
@@ -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,
This page took 0.02727 seconds and 5 git commands to generate.