mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-02 07:17:59 +02:00
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>
This commit is contained in:
parent
b1d29497d6
commit
bb32afe831
1 changed files with 4 additions and 2 deletions
|
|
@ -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:
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue