check for little endian

This commit is contained in:
hippoz 2022-12-26 20:31:12 +02:00
parent 8a218a7ac2
commit 3ea788d1a7
Signed by: hippoz
GPG key ID: 56C4E02A85F2FBED

5
wire.c
View file

@ -128,6 +128,11 @@ int wire_parse_message(wire_context_t *c, wire_message_t *msg)
{ {
// SPEC: https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages // SPEC: https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages
msg->endianness = *(uint8_t*)TRYPTR(wire_get_u8(c)); msg->endianness = *(uint8_t*)TRYPTR(wire_get_u8(c));
if (msg->endianness == 'B') {
// we only support little endian
return -1;
}
msg->type = *(uint8_t*)TRYPTR(wire_get_u8(c)); msg->type = *(uint8_t*)TRYPTR(wire_get_u8(c));
msg->flags = *(uint8_t*)TRYPTR(wire_get_u8(c)); msg->flags = *(uint8_t*)TRYPTR(wire_get_u8(c));
msg->protocol_version = *(uint8_t*)TRYPTR(wire_get_u8(c)); msg->protocol_version = *(uint8_t*)TRYPTR(wire_get_u8(c));