diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-12-10 16:16:59 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-12-10 16:16:59 +0100 |
commit | 8ff34300bfb739d98084b03dd9252a979d9c4c7e (patch) | |
tree | 015b9aebc5f279c3f93479bb4212e999bb659ba6 /lib/Utils | |
parent | beec76dea01b02b4a1c44f717bb5249425582e20 (diff) | |
download | abrt-8ff34300bfb739d98084b03dd9252a979d9c4c7e.tar.gz abrt-8ff34300bfb739d98084b03dd9252a979d9c4c7e.tar.xz abrt-8ff34300bfb739d98084b03dd9252a979d9c4c7e.zip |
dbus lib: fix parsing of 0-element arrays. Fixes bug 95
See https://fedorahosted.org/abrt/ticket/95
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'lib/Utils')
-rw-r--r-- | lib/Utils/abrt_dbus.h | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/Utils/abrt_dbus.h b/lib/Utils/abrt_dbus.h index b31a015c..bc9889a7 100644 --- a/lib/Utils/abrt_dbus.h +++ b/lib/Utils/abrt_dbus.h @@ -194,17 +194,19 @@ static int load_vector(DBusMessageIter* iter, std::vector<E>& val) int r; //int cnt = 0; - //type = dbus_message_iter_get_arg_type(&sub_iter); - /* here "type" is the element's type, and it will be checked by load_val */ - // if (type != DBUS_TYPE_INVALID) - not needed? - do { - E elem; + /* When the vector has 0 elements, we see DBUS_TYPE_INVALID here */ + type = dbus_message_iter_get_arg_type(&sub_iter); + if (type != DBUS_TYPE_INVALID) + { + do { + E elem; //cnt++; - r = load_val(&sub_iter, elem); - if (r < 0) - return r; - val.push_back(elem); - } while (r == ABRT_DBUS_MORE_FIELDS); + r = load_val(&sub_iter, elem); + if (r < 0) + return r; + val.push_back(elem); + } while (r == ABRT_DBUS_MORE_FIELDS); + } //log("%s: %d elems", __func__, cnt); return dbus_message_iter_next(iter); |