diff options
author | Colin Walters <walters@verbum.org> | 2005-06-16 04:27:45 +0000 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2005-06-16 04:27:45 +0000 |
commit | 5935f33b75ee7830d5521317e1686ec767bce502 (patch) | |
tree | aaeeb4d71aaafa6aa8341dc92e8ff30a877c4088 /dbus/dbus-marshal-byteswap.c | |
parent | 5cd4c9ac5fb269a413f58d188b214b1ee4f6a5a6 (diff) |
2005-06-16 Colin Walters <walters@verbum.org>
* dbus/dbus-marshal-header.c (_dbus_header_load): Set
header byte order from expected byte order (Patch from Chris Wilson, #3475).
* dbus/dbus-marshal-byteswap.c (byteswap_body_helper):
Increment pointer after swapping fixed array. Add assertion
for array length.
Diffstat (limited to 'dbus/dbus-marshal-byteswap.c')
-rw-r--r-- | dbus/dbus-marshal-byteswap.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/dbus/dbus-marshal-byteswap.c b/dbus/dbus-marshal-byteswap.c index 7571e2fc..80cc1ce8 100644 --- a/dbus/dbus-marshal-byteswap.c +++ b/dbus/dbus-marshal-byteswap.c @@ -90,7 +90,7 @@ byteswap_body_helper (DBusTypeReader *reader, p = _DBUS_ALIGN_ADDRESS (p, 4); array_len = _dbus_unpack_uint32 (old_byte_order, p); - + *((dbus_uint32_t*)p) = DBUS_UINT32_SWAP_LE_BE (*((dbus_uint32_t*)p)); p += 4; @@ -102,12 +102,15 @@ byteswap_body_helper (DBusTypeReader *reader, elem_type = _dbus_type_reader_get_element_type (reader); alignment = _dbus_type_get_alignment (elem_type); + _dbus_assert ((array_len / alignment) < DBUS_MAXIMUM_ARRAY_LENGTH); + p = _DBUS_ALIGN_ADDRESS (p, alignment); if (dbus_type_is_fixed (elem_type)) { if (alignment > 1) - _dbus_swap_array (p, array_len / alignment, alignment); + _dbus_swap_array (p, array_len / alignment, alignment); + p += array_len; } else { |