From: Simon McVittie Date: Wed, 10 Feb 2016 13:15:56 +0000 (+0000) Subject: AppArmor: do not mix dbus_bool_t with int X-Git-Tag: dbus-1.11.2~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=881d7cb064ca4e268b060f898acef93c08a9e3b5;p=thirdparty%2Fdbus.git AppArmor: do not mix dbus_bool_t with int libdbus uses dbus_bool_t for booleans; that type is unsigned 32-bit. However, libapparmor uses int, which is signed, leading to -Wpointer-sign warnings when we pass a dbus_bool_t * where an int * was expected. This file is Linux-specific, and all Linux platforms have 32-bit int and an in-memory representation of the integers 0 and 1 that is independent of signedness, so the previous code was harmless in practice. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93069 Signed-off-by: Simon McVittie Reviewed-by: Ralf Habacker --- diff --git a/bus/apparmor.c b/bus/apparmor.c index 3ba84d8da..c679ac54a 100644 --- a/bus/apparmor.c +++ b/bus/apparmor.c @@ -606,7 +606,9 @@ bus_apparmor_allows_acquire_service (DBusConnection *connection, BusAppArmorConfinement *con = NULL; DBusString qstr, auxdata; dbus_bool_t free_auxdata = FALSE; - dbus_bool_t allow = FALSE, audit = TRUE; + /* the AppArmor API uses pointers to int for pointers to boolean, and + * int is not strictly guaranteed to be the same as dbus_bool_t */ + int allow = FALSE, audit = TRUE; unsigned long pid; int res, serrno = 0; @@ -742,8 +744,8 @@ bus_apparmor_allows_send (DBusConnection *sender, #ifdef HAVE_APPARMOR BusAppArmorConfinement *src_con = NULL, *dst_con = NULL; DBusString qstr, auxdata; - dbus_bool_t src_allow = FALSE, dst_allow = FALSE; - dbus_bool_t src_audit = TRUE, dst_audit = TRUE; + int src_allow = FALSE, dst_allow = FALSE; + int src_audit = TRUE, dst_audit = TRUE; dbus_bool_t free_auxdata = FALSE; unsigned long pid; int len, res, src_errno = 0, dst_errno = 0; @@ -1006,7 +1008,7 @@ bus_apparmor_allows_eavesdropping (DBusConnection *connection, #ifdef HAVE_APPARMOR BusAppArmorConfinement *con = NULL; DBusString qstr, auxdata; - dbus_bool_t allow = FALSE, audit = TRUE; + int allow = FALSE, audit = TRUE; dbus_bool_t free_auxdata = FALSE; unsigned long pid; int res, serrno = 0;