diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-03-03 16:29:17 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-03-04 12:40:30 +0000 |
commit | bb32afe831ca6e5913e7dd6035d1167c09c54e29 (patch) | |
tree | 8fbb0f819bb0f2a4911200d72957ce8bc0253b4a | |
parent | b1d29497d6076c40fed8e151c0b2226e4f86ef62 (diff) |
dbus_message_iter_append_basic: validate booleans too
Sending, for instance, ((dbus_bool_t) 666) is a programming error and
should be diagnosed as such.
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 | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c index c6b52f55..a8378e30 100644 --- a/dbus/dbus-message.c +++ b/dbus/dbus-message.c @@ -2519,6 +2519,7 @@ dbus_message_iter_append_basic (DBusMessageIter *iter, switch (type) { const char * const *string_p; + const dbus_bool_t *bool_p; case DBUS_TYPE_STRING: string_p = value; @@ -2536,8 +2537,9 @@ dbus_message_iter_append_basic (DBusMessageIter *iter, break; case DBUS_TYPE_BOOLEAN: - /* FIXME: strictly speaking we should ensure that it's in {0,1}, - * but for now, fall through */ + bool_p = value; + _dbus_return_val_if_fail (*bool_p == 0 || *bool_p == 1, FALSE); + break; default: { |