summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-marshal.c
diff options
context:
space:
mode:
authorOlivier Andrieu <oliv__a@users.sourceforge.net>2004-03-21 13:42:23 +0000
committerOlivier Andrieu <oliv__a@users.sourceforge.net>2004-03-21 13:42:23 +0000
commiteacb2afdc2903874f5dfde80b4ee338ea333c75e (patch)
tree1324bd2b577fcd281231f32762030d6e3b6657df /dbus/dbus-marshal.c
parent4fd4d52dd679486edc4543cd93c9f4d01cd8f90e (diff)
* dbus/dbus-marshal.c (_dbus_marshal_validate_arg): accept empty
arrays * dbus/dbus-message.h, bus/dbus-message.c (dbus_message_iter_init) (dbus_message_iter_init_array_iterator) (dbus_message_iter_init_dict_iterator): return a dbus_bool_t to indicate whether the iterator is empty * dbus/dbus-pending-call.c, dbus/dbus-server.c: silence compiler warnings
Diffstat (limited to 'dbus/dbus-marshal.c')
-rw-r--r--dbus/dbus-marshal.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/dbus/dbus-marshal.c b/dbus/dbus-marshal.c
index e19e36bb..7524452b 100644
--- a/dbus/dbus-marshal.c
+++ b/dbus/dbus-marshal.c
@@ -2116,7 +2116,10 @@ _dbus_marshal_validate_arg (const DBusString *str,
len = demarshal_and_validate_len (str, byte_order, pos, &pos);
if (len < 0)
- return FALSE;
+ {
+ _dbus_verbose ("invalid array length (<0)\n");
+ return FALSE;
+ }
if (len > _dbus_string_get_length (str) - pos)
{
@@ -2126,10 +2129,13 @@ _dbus_marshal_validate_arg (const DBusString *str,
end = pos + len;
- if (!validate_array_data (str, byte_order, depth + 1,
- array_type, array_type_pos,
- pos, &pos, end))
- return FALSE;
+ if (len > 0 && !validate_array_data (str, byte_order, depth + 1,
+ array_type, array_type_pos,
+ pos, &pos, end))
+ {
+ _dbus_verbose ("invalid array data\n");
+ return FALSE;
+ }
if (pos < end)
{