Skip to content

Commit

Permalink
fix null-deref due to unconstructed PrivacyNodeInfo
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
deprekated committed Nov 15, 2024
1 parent 8645115 commit 86ce9f7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/util/pipewire/pipewire_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down

0 comments on commit 86ce9f7

Please sign in to comment.