dbus/dbus dbus-marshal-header.c, 1.13, 1.14 dbus-marshal-byteswap.c, 1.4, 1.5

Colin Walters walters at freedesktop.org
Wed Jun 15 21:27:48 PDT 2005


Update of /cvs/dbus/dbus/dbus
In directory gabe:/tmp/cvs-serv28925/dbus

Modified Files:
	dbus-marshal-header.c dbus-marshal-byteswap.c 
Log Message:
2005-06-16  Colin Walters  <walters at 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.


Index: dbus-marshal-header.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-marshal-header.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- dbus-marshal-header.c	15 Jun 2005 15:15:32 -0000	1.13
+++ dbus-marshal-header.c	16 Jun 2005 04:27:45 -0000	1.14
@@ -1040,6 +1040,7 @@
   _dbus_type_reader_next (&reader);
 
   _dbus_assert (v_byte == byte_order);
+  header->byte_order = byte_order;
 
   /* MESSAGE TYPE */
   _dbus_assert (_dbus_type_reader_get_current_type (&reader) == DBUS_TYPE_BYTE);

Index: dbus-marshal-byteswap.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-marshal-byteswap.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- dbus-marshal-byteswap.c	9 Mar 2005 17:09:11 -0000	1.4
+++ dbus-marshal-byteswap.c	16 Jun 2005 04:27:45 -0000	1.5
@@ -90,7 +90,7 @@
             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 @@
                 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
                   {



More information about the dbus-commit mailing list