From 36038679a47861ffc7e937ea6446d6ca3805b109 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Tue, 14 Jun 2022 12:01:22 -0400 Subject: [PATCH] Fix: sessiond: registry_channel: initialize _rcu_head and _node MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 1490020 Uninitialized pointer field The pointer field will point to an arbitrary memory location, any attempt to write may cause corruption. In lttng::​sessiond::​ust::​registry_channel::​registry_channel(unsigned int, std::​function, std::​function): A pointer field is not initialized in the constructor (CWE-457) Signed-off-by: Jérémie Galarneau Change-Id: Ie043af750941a02a65ba69e70fe2620349989398 --- src/bin/lttng-sessiond/ust-registry-channel.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/bin/lttng-sessiond/ust-registry-channel.cpp b/src/bin/lttng-sessiond/ust-registry-channel.cpp index a2a1707dc..e7fe73971 100644 --- a/src/bin/lttng-sessiond/ust-registry-channel.cpp +++ b/src/bin/lttng-sessiond/ust-registry-channel.cpp @@ -99,6 +99,13 @@ lsu::registry_channel::registry_channel(unsigned int channel_id, /* Set custom match function. */ _events->match_fct = ht_match_event; _events->hash_fct = ht_hash_event; + + _rcu_head = {}; + /* + * Node's key is initialized by the channel's parent session. Its value is irrelevant to the + * channel object itself. + */ + _node = {}; } void lsu::registry_channel::add_event( -- 2.34.1