From 2a84a2d86888c36f526a2956ceea4fc0621a71f8 Mon Sep 17 00:00:00 2001 From: Andrey Gusakov Date: Mon, 23 Jun 2014 09:55:51 +0400 Subject: [PATCH] dbus: use 'int' instead of 'bool' in sd_bus sd_bus never uses 'bool', and given the weird implicit type promotions, it is totally right to do so. Make sure we never pass pointers to 'bool' to va_arg sd_bus functions to avoid overwriting stack space. Signed-off-by: Andrey Gusakov Signed-off-by: David Herrmann --- src/ctl/ctl-wifi.c | 8 ++++---- src/wifi/wifid-dbus.c | 4 +--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/ctl/ctl-wifi.c b/src/ctl/ctl-wifi.c index 216c6e4..f9d854e 100644 --- a/src/ctl/ctl-wifi.c +++ b/src/ctl/ctl-wifi.c @@ -106,9 +106,9 @@ static int ctl_peer_parse_properties(struct ctl_peer *p, const char *t, *p2p_mac = NULL, *friendly_name = NULL; const char *interface = NULL, *local_address = NULL; const char *remote_address = NULL, *wfd_subelements = NULL; - bool connected, connected_set = false; + bool connected_set = false; char *tmp; - int r; + int connected, r; if (!p || !m) return cli_EINVAL(); @@ -413,9 +413,9 @@ static int ctl_link_parse_properties(struct ctl_link *l, const char *t, *interface_name = NULL, *friendly_name = NULL; const char *wfd_subelements = NULL; unsigned int interface_index = 0; - bool p2p_scanning, p2p_scanning_set = false; + bool p2p_scanning_set = false; char *tmp; - int r; + int p2p_scanning, r; if (!l || !m) return cli_EINVAL(); diff --git a/src/wifi/wifid-dbus.c b/src/wifi/wifid-dbus.c index 5547fc1..042778b 100644 --- a/src/wifi/wifid-dbus.c +++ b/src/wifi/wifid-dbus.c @@ -20,7 +20,6 @@ #define LOG_SUBSYSTEM "dbus" #include -#include #include #include #include @@ -558,8 +557,7 @@ static int link_dbus_set_p2p_scanning(sd_bus *bus, sd_bus_error *err) { struct link *l = data; - bool val; - int r; + int val, r; r = sd_bus_message_read(value, "b", &val); if (r < 0)