From 207139e65e6707100d2e92d96b1a4c3bfaa88a5f Mon Sep 17 00:00:00 2001 From: Mikko Harju Date: Thu, 13 Aug 2015 03:09:07 -0400 Subject: [PATCH 5/6] Use gboolean instead of bool The "use-dbus" is a boolean g_object property, with actual type of gboolean, and gboolean is typedef int. g_object_get is a variadic function (no static type checking), and stores the queried value through pointer-to-int. If sizeof(bool) happens to be less than sizeof(int) and the stack variable useDBus is packed tightly, this can lead to stack corruption. Compiling the lib with -fstack-protector immediately pointed out the problem. --- Accounts/manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Accounts/manager.cpp b/Accounts/manager.cpp index 2eb077f..1ac78d0 100644 --- a/Accounts/manager.cpp +++ b/Accounts/manager.cpp @@ -530,7 +530,7 @@ bool Manager::abortOnTimeout() const */ Manager::Options Manager::options() const { - bool useDBus = true; + gboolean useDBus = true; g_object_get(d->m_manager, "use-dbus", &useDBus, NULL); -- 2.5.0