From 86ce9f7278edd5a27467caf3749e8a07e4588260 Mon Sep 17 00:00:00 2001 From: Kate Adkins Date: Fri, 15 Nov 2024 12:04:56 -0700 Subject: [PATCH] fix null-deref due to unconstructed PrivacyNodeInfo This would cause Waybar to crash if the privacy module ever got e.g. a empty (but properly null-terminated) string for the application_name. --- src/util/pipewire/pipewire_backend.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/util/pipewire/pipewire_backend.cpp b/src/util/pipewire/pipewire_backend.cpp index 5bb7c19a1..3b8971780 100644 --- a/src/util/pipewire/pipewire_backend.cpp +++ b/src/util/pipewire/pipewire_backend.cpp @@ -126,6 +126,7 @@ void PipewireBackend::handleRegistryEventGlobal(uint32_t id, uint32_t permission if (proxy == nullptr) return; auto *pNodeInfo = (PrivacyNodeInfo *)pw_proxy_get_user_data(proxy); + new(pNodeInfo) PrivacyNodeInfo{}; pNodeInfo->id = id; pNodeInfo->data = this; pNodeInfo->type = mediaType; @@ -142,6 +143,7 @@ void PipewireBackend::handleRegistryEventGlobalRemove(uint32_t id) { mutex_.lock(); auto iter = privacy_nodes.find(id); if (iter != privacy_nodes.end()) { + privacy_nodes[id]->~PrivacyNodeInfo(); privacy_nodes.erase(id); } mutex_.unlock();