diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-03-03 16:30:00 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-03-04 12:40:40 +0000 |
commit | a9cbeecfcc2fee6e89bf1f5e1dd2a8f0fe860c55 (patch) | |
tree | d6493b0f84eac3bee7d7c005dc16105bbae87982 | |
parent | bb32afe831ca6e5913e7dd6035d1167c09c54e29 (diff) | |
download | dbus-a9cbeecfcc2fee6e89bf1f5e1dd2a8f0fe860c55.tar.gz |
dbus_message_iter_append_fixed_array: add a check for valid booleans
The reasoning is the same as for dbus_message_iter_append_basic.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=16338
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
-rw-r--r-- | dbus/dbus-message.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c index a8378e30..075ff311 100644 --- a/dbus/dbus-message.c +++ b/dbus/dbus-message.c @@ -2660,6 +2660,19 @@ dbus_message_iter_append_fixed_array (DBusMessageIter *iter, DBUS_MAXIMUM_ARRAY_LENGTH / _dbus_type_get_alignment (element_type), FALSE); +#ifndef DBUS_DISABLE_CHECKS + if (element_type == DBUS_TYPE_BOOLEAN) + { + const dbus_bool_t * const *bools = value; + int i; + + for (i = 0; i < n_elements; i++) + { + _dbus_return_val_if_fail ((*bools)[i] == 0 || (*bools)[i] == 1, FALSE); + } + } +#endif + ret = _dbus_type_writer_write_fixed_multi (&real->u.writer, element_type, value, n_elements); return ret; |