From b7bc5ba7a323c6a17a442310c40585b67edff5d4 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Wed, 26 Feb 2003 22:08:19 +0000 Subject: 2003-02-26 Havoc Pennington All kinds of audit fixes from Owen, plus initial attempt to handle unaligned memory returned from malloc. * dbus/dbus-string.c (_dbus_string_init): clamp max length to leave room for align_offset and nul byte (fixup_alignment): function to track an align_offset and ensure real->str is aligned (DBUS_GENERIC_STRING_PREAMBLE): len must be less than allocated, to allow a nul byte plus align offset (_dbus_string_lock): fix overflow issue (_dbus_string_init_const_len): add assertions on sanity of len, assign allocated to be ALLOCATION_PADDING larger than len (set_length): fixup the overflow handling (_dbus_string_get_data_len): fix overflow in assertion (open_gap): detect overflow in size of gap to be opened (_dbus_string_lengthen): add overflow check (_dbus_string_align_length): fix overflow with _DBUS_ALIGN_VALUE (_dbus_string_append): add overflow check (_dbus_string_append_unichar): overflow (_dbus_string_delete): fix overflow in assertion (_dbus_string_copy_len): overflow in assertion (_dbus_string_replace_len): overflows in assertions (_dbus_string_find): change to implement in terms of _dbus_string_find_to (_dbus_string_find_to): assorted fixage (_dbus_string_equal_c_str): assert c_str != NULL, fix logic so the function works (_dbus_string_ends_with_c_str): fix overflow thingy (_dbus_string_base64_encode): overflow fix (_dbus_string_validate_ascii): overflow (_dbus_string_validate_nul): overflow --- dbus/dbus-string.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'dbus/dbus-string.h') diff --git a/dbus/dbus-string.h b/dbus/dbus-string.h index 25cdd4dd..1f7d4919 100644 --- a/dbus/dbus-string.h +++ b/dbus/dbus-string.h @@ -39,9 +39,10 @@ struct DBusString int dummy2; /**< placeholder */ int dummy3; /**< placeholder */ int dummy4; /**< placeholder */ - unsigned int dummy5 : 1; /** placeholder */ - unsigned int dummy6 : 1; /** placeholder */ - unsigned int dummy7 : 1; /** placeholder */ + unsigned int dummy5 : 1; /**< placeholder */ + unsigned int dummy6 : 1; /**< placeholder */ + unsigned int dummy7 : 1; /**< placeholder */ + unsigned int dummy8 : 3; /**< placeholder */ }; dbus_bool_t _dbus_string_init (DBusString *str, -- cgit