From 7ba714ad7fe8256edfaad7d9a0f09aeb9611ca44 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Thu, 30 Jan 2003 04:20:44 +0000 Subject: 2003-01-30 Havoc Pennington * dbus/dbus-message.c: use message->byte_order instead of DBUS_COMPILER_BYTE_ORDER throughout. (dbus_message_create_header): pad header to align the start of the body of the message to 8-byte boundary * dbus/dbus-marshal.h: make all the demarshalers take const DBusString arguments. * dbus/dbus-message.c (_dbus_message_loader_return_buffer): validate message args here, so we don't have to do slow validation later, and so we catch bad messages as they are incoming. Also add better checks on header_len and body_len. Also fill in message->byte_order * dbus/dbus-string.c (_dbus_string_validate_utf8): new (not implemented properly) (_dbus_string_validate_nul): new function to check all-nul * dbus/dbus-marshal.c (_dbus_marshal_get_field_end_pos): rename get_arg_end_pos and remove all validation (_dbus_marshal_validate_arg): actually do validation here. --- dbus/dbus-marshal.h | 99 +++++++++++++++++++++++++++-------------------------- 1 file changed, 51 insertions(+), 48 deletions(-) (limited to 'dbus/dbus-marshal.h') diff --git a/dbus/dbus-marshal.h b/dbus/dbus-marshal.h index bdeeccb9..cedca6b8 100644 --- a/dbus/dbus-marshal.h +++ b/dbus/dbus-marshal.h @@ -124,54 +124,57 @@ dbus_bool_t _dbus_marshal_string_array (DBusString *str, const char **value, int len); -double _dbus_demarshal_double (DBusString *str, - int byte_order, - int pos, - int *new_pos); -dbus_int32_t _dbus_demarshal_int32 (DBusString *str, - int byte_order, - int pos, - int *new_pos); -dbus_uint32_t _dbus_demarshal_uint32 (DBusString *str, - int byte_order, - int pos, - int *new_pos); -char * _dbus_demarshal_string (DBusString *str, - int byte_order, - int pos, - int *new_pos); -unsigned char *_dbus_demarshal_byte_array (DBusString *str, - int byte_order, - int pos, - int *new_pos, - int *array_len); -dbus_int32_t *_dbus_demarshal_int32_array (DBusString *str, - int byte_order, - int pos, - int *new_pos, - int *array_len); -dbus_uint32_t *_dbus_demarshal_uint32_array (DBusString *str, - int byte_order, - int pos, - int *new_pos, - int *array_len); -double *_dbus_demarshal_double_array (DBusString *str, - int byte_order, - int pos, - int *new_pos, - int *array_len); -char **_dbus_demarshal_string_array (DBusString *str, - int byte_order, - int pos, - int *new_pos, - int *array_len); - -dbus_bool_t _dbus_marshal_get_field_end_pos (DBusString *str, - int byte_order, - int pos, - int *end_pos); - - +double _dbus_demarshal_double (const DBusString *str, + int byte_order, + int pos, + int *new_pos); +dbus_int32_t _dbus_demarshal_int32 (const DBusString *str, + int byte_order, + int pos, + int *new_pos); +dbus_uint32_t _dbus_demarshal_uint32 (const DBusString *str, + int byte_order, + int pos, + int *new_pos); +char * _dbus_demarshal_string (const DBusString *str, + int byte_order, + int pos, + int *new_pos); +unsigned char *_dbus_demarshal_byte_array (const DBusString *str, + int byte_order, + int pos, + int *new_pos, + int *array_len); +dbus_int32_t * _dbus_demarshal_int32_array (const DBusString *str, + int byte_order, + int pos, + int *new_pos, + int *array_len); +dbus_uint32_t *_dbus_demarshal_uint32_array (const DBusString *str, + int byte_order, + int pos, + int *new_pos, + int *array_len); +double * _dbus_demarshal_double_array (const DBusString *str, + int byte_order, + int pos, + int *new_pos, + int *array_len); +char ** _dbus_demarshal_string_array (const DBusString *str, + int byte_order, + int pos, + int *new_pos, + int *array_len); + + +dbus_bool_t _dbus_marshal_get_arg_end_pos (const DBusString *str, + int byte_order, + int pos, + int *end_pos); +dbus_bool_t _dbus_marshal_validate_arg (const DBusString *str, + int byte_order, + int pos, + int *end_pos); #endif /* DBUS_PROTOCOL_H */ -- cgit