From 5e389fdf499c39926c61b47fcafb5e71291ce1a2 Mon Sep 17 00:00:00 2001 From: "John (J5) Palmieri" Date: Wed, 15 Jun 2005 15:15:32 +0000 Subject: * dbus/dbus-marshal-validate.h: Added a new validation error code DBUS_VALIDITY_UNKNOWN_OOM_ERROR = -4 for out of memory errors when validating signitures * dbus/dbus-marshal-header.c: use DBUS_VALIDITY_UNKNOWN_OOM_ERROR in places where we previously used DBUS_VALID and a FALSE return value to indicate OOM * dbus/dbus-marshal-validate.c (_dbus_validate_signature_with_reason): Use a stack to track the number of elements inside containers. The stack values are then used to validate that dict entries have only two elements within them. (validate_body_helper): check the reason for failure when validating varients * dbus/dbus-message.c (load_message): use DBUS_VALIDITY_UNKNOWN_OOM_ERROR in places where we previously used DBUS_VALID and a FALSE return value to indicate OOM * doc/TODO: remove "- validate dict entry number of fields" as this patch fixes it --- dbus/dbus-marshal-header.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'dbus/dbus-marshal-header.c') diff --git a/dbus/dbus-marshal-header.c b/dbus/dbus-marshal-header.c index 967a01e3..83fbd3bf 100644 --- a/dbus/dbus-marshal-header.c +++ b/dbus/dbus-marshal-header.c @@ -926,9 +926,10 @@ load_and_validate_field (DBusHeader *header, * Creates a message header from potentially-untrusted data. The * return value is #TRUE if there was enough memory and the data was * valid. If it returns #TRUE, the header will be created. If it - * returns #FALSE and *validity == #DBUS_VALID, then there wasn't - * enough memory. If it returns #FALSE and *validity != #DBUS_VALID - * then the data was invalid. + * returns #FALSE and *validity == #DBUS_VALIDITY_UNKNOWN_OOM_ERROR, + * then there wasn't enough memory. If it returns #FALSE + * and *validity != #DBUS_VALIDITY_UNKNOWN_OOM_ERROR then the data was + * invalid. * * The byte_order, fields_array_len, and body_len args should be from * _dbus_header_have_message_untrusted(). Validation performed in @@ -977,7 +978,7 @@ _dbus_header_load (DBusHeader *header, if (!_dbus_string_copy_len (str, start, header_len, &header->data, 0)) { _dbus_verbose ("Failed to copy buffer into new header\n"); - *validity = DBUS_VALID; + *validity = DBUS_VALIDITY_UNKNOWN_OOM_ERROR; return FALSE; } -- cgit