From ae8cc76db4b2978f4afd2b6a8213fdb2c72d940a Mon Sep 17 00:00:00 2001 From: Tyler Hicks Date: Wed, 22 Oct 2014 16:36:23 -0400 Subject: [FIX FOR 08/13] fix: initialize reserved area at the start of the query string Signed-off-by: Tyler Hicks --- bus/apparmor.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bus/apparmor.c b/bus/apparmor.c index dc90f22..6641663 100644 --- a/bus/apparmor.c +++ b/bus/apparmor.c @@ -274,7 +274,11 @@ query_append (DBusString *query, const char *buffer) static dbus_bool_t build_common_query (DBusString *query, const char *con, const char *bustype) { - return _dbus_string_set_length (query, AA_QUERY_CMD_LABEL_SIZE) && + /** + * libapparmor's aa_query_label() function scribbles over the first + * AA_QUERY_CMD_LABEL_SIZE bytes of the query string with a private value. + */ + return _dbus_string_insert_bytes (query, 0, AA_QUERY_CMD_LABEL_SIZE, 0) && _dbus_string_append (query, con) && _dbus_string_append_byte (query, '\0') && _dbus_string_append_byte (query, AA_CLASS_DBUS) && -- 2.1.0