From: Jérémie Galarneau Date: Tue, 14 Jun 2022 16:01:22 +0000 (-0400) Subject: Fix: sessiond: registry_channel: initialize _rcu_head and _node X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=36038679a47861ffc7e937ea6446d6ca3805b109;p=lttng-tools.git Fix: sessiond: registry_channel: initialize _rcu_head and _node 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 --- 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(