diff options
author | Chengwei Yang <chengwei.yang@intel.com> | 2013-10-11 16:35:17 +0800 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2013-11-01 11:24:18 +0000 |
commit | 576c34dbc0775450623f289f012fb938a84c58a8 (patch) | |
tree | 351a24f99d0f64970a0b5d390c15360644a5f676 /dbus | |
parent | 8b8bbe4c8b4693681e8c5d45431d1798091f4bdc (diff) | |
download | dbus-576c34dbc0775450623f289f012fb938a84c58a8.tar.gz |
Correctly set number of arguments already handled
At privous, which increments the number of arguments already handled in
the last of loop, however, if there is any invalid argument, then it
will "goto out" and the number of arguments already handled is now
incorrect.
A following patch will use the number of arguments already handled as a
loop terminate condition, so it's good to fix it before.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=21259
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Diffstat (limited to 'dbus')
-rw-r--r-- | dbus/dbus-message.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c index 9546da12..4f234d52 100644 --- a/dbus/dbus-message.c +++ b/dbus/dbus-message.c @@ -982,15 +982,16 @@ _dbus_message_iter_get_args_valist (DBusMessageIter *iter, } #endif + /* how many arguments already handled */ + i++; + spec_type = va_arg (var_args, int); if (!_dbus_type_reader_next (&real->u.reader) && spec_type != DBUS_TYPE_INVALID) { dbus_set_error (error, DBUS_ERROR_INVALID_ARGS, - "Message has only %d arguments, but more were expected", i + 1); + "Message has only %d arguments, but more were expected", i); goto out; } - - i++; } retval = TRUE; |