sd-bus: make sure bus_map_all_properties() handle booleans right

sd-bus generally exposes bools as "int" instead of "bool" in the public API.
This is relevant when unmarshaling booleans, as the relevant functions expect
an int* pointer and no bool* pointer. Since sizeof(bool) is not necessarily the
same as sizeof(int) this is problematic and might result in memory corruption.

Let's fix this, and make sure bus_map_all_properties() handles booleans as
ints, as the rest of sd-bus, and make all users of it expect the right thing.
This commit is contained in:
Lennart Poettering
2016-06-21 13:20:48 +02:00
parent 943ef07ce0
commit 43dcc86a13
3 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -1048,7 +1048,7 @@ static int map_basic(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_
case SD_BUS_TYPE_BOOLEAN: {
unsigned b;
bool *p = userdata;
int *p = userdata;
r = sd_bus_message_read_basic(m, type, &b);
if (r < 0)