summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2011-06-09 17:52:10 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2011-06-10 18:09:41 +0100
commitc3223ba6c401ba81df1305851312a47c485e6cd7 (patch)
tree93476987c2ef46d431a95f2dea5a351328e6f274
parent50732523a78254b28fad9427c91f774292de69cd (diff)
_dbus_header_byteswap: change the first byte of the message, not just the struct member
This has been wrong approximately forever, for instance see: http://lists.freedesktop.org/archives/dbus/2007-March/007357.html Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38120 Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=629938 Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
-rw-r--r--dbus/dbus-marshal-header.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/dbus/dbus-marshal-header.c b/dbus/dbus-marshal-header.c
index 3f31d7a0..a6c9b80d 100644
--- a/dbus/dbus-marshal-header.c
+++ b/dbus/dbus-marshal-header.c
@@ -1468,14 +1468,20 @@ void
1468_dbus_header_byteswap (DBusHeader *header, 1468_dbus_header_byteswap (DBusHeader *header,
1469 int new_order) 1469 int new_order)
1470{ 1470{
1471 unsigned char byte_order;
1472
1471 if (header->byte_order == new_order) 1473 if (header->byte_order == new_order)
1472 return; 1474 return;
1473 1475
1476 byte_order = _dbus_string_get_byte (&header->data, BYTE_ORDER_OFFSET);
1477 _dbus_assert (header->byte_order == byte_order);
1478
1474 _dbus_marshal_byteswap (&_dbus_header_signature_str, 1479 _dbus_marshal_byteswap (&_dbus_header_signature_str,
1475 0, header->byte_order, 1480 0, header->byte_order,
1476 new_order, 1481 new_order,
1477 &header->data, 0); 1482 &header->data, 0);
1478 1483
1484 _dbus_string_set_byte (&header->data, BYTE_ORDER_OFFSET, new_order);
1479 header->byte_order = new_order; 1485 header->byte_order = new_order;
1480} 1486}
1481 1487