bazzite/spec_files/upower/0004-up-polkit-Add-G_ADD_PRIVATE-UpPolkit.patch
2024-09-17 11:16:18 -07:00

31 lines
915 B
Diff

From b4697dbc626ced1a456bcb4aba8dca2fe1efa901 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
Date: Sat, 31 Aug 2024 11:05:54 +0200
Subject: [PATCH 4/9] up-polkit: Add `G_ADD_PRIVATE (UpPolkit)`
Without this, accesses to `UpPolkitPrivate` are actually out of bounds
and writing to it will cause heap corruption.
Fixes: https://gitlab.freedesktop.org/upower/upower/-/issues/281
---
src/up-polkit.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/up-polkit.c b/src/up-polkit.c
index 0ede5a7..e0ba246 100644
--- a/src/up-polkit.c
+++ b/src/up-polkit.c
@@ -43,7 +43,8 @@ struct UpPolkitPrivate
#endif
};
-G_DEFINE_TYPE (UpPolkit, up_polkit, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_CODE (UpPolkit, up_polkit, G_TYPE_OBJECT,
+ G_ADD_PRIVATE (UpPolkit))
static gpointer up_polkit_object = NULL;
#ifdef HAVE_POLKIT
--
2.46.0