Fix: sessiond: registry_channel: initialize _rcu_head and _node
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 14 Jun 2022 16:01:22 +0000 (12:01 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 15 Jun 2022 15:07:55 +0000 (11:07 -0400)
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<void (lttng::​sessiond::​ust::​registry_channel const &)>, std::​function<void (lttng::​sessiond::​ust::​registry_channel const &, lttng::​sessiond::​ust::​registry_event const &)>): A pointer field is not initialized in the constructor (CWE-457)

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ie043af750941a02a65ba69e70fe2620349989398

src/bin/lttng-sessiond/ust-registry-channel.cpp

index a2a1707dcbc180b3508c900b6fc0ff97bb982e9b..e7fe73971391c60cca06537bbc830701746e999a 100644 (file)
@@ -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(
This page took 0.026201 seconds and 4 git commands to generate.