aboutsummaryrefslogtreecommitdiff
path: root/qapi/qobject-input-visitor.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2017-03-03 13:32:47 +0100
committerMarkus Armbruster <armbru@redhat.com>2017-03-05 09:14:20 +0100
commit1f41a645b65530859bf5984aa08e103bb452b473 (patch)
tree58b0350fe6cf6b89439ec1a8fdf6a970267c5ec5 /qapi/qobject-input-visitor.c
parenta9416dc62c36079b93b4951c894a0b15e53bb38c (diff)
downloadqemu-1f41a645b65530859bf5984aa08e103bb452b473.zip
qemu-1f41a645b65530859bf5984aa08e103bb452b473.tar.gz
qemu-1f41a645b65530859bf5984aa08e103bb452b473.tar.bz2
qapi: Fix object input visit beyond end of list
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <1488544368-30622-28-git-send-email-armbru@redhat.com>
Diffstat (limited to 'qapi/qobject-input-visitor.c')
-rw-r--r--qapi/qobject-input-visitor.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/qapi/qobject-input-visitor.c b/qapi/qobject-input-visitor.c
index 34065ba..d192727 100644
--- a/qapi/qobject-input-visitor.c
+++ b/qapi/qobject-input-visitor.c
@@ -122,10 +122,15 @@ static QObject *qobject_input_try_get_object(QObjectInputVisitor *qiv,
} else {
assert(qobject_type(qobj) == QTYPE_QLIST);
assert(!name);
- ret = qlist_entry_obj(tos->entry);
- assert(ret);
+ if (tos->entry) {
+ ret = qlist_entry_obj(tos->entry);
+ if (consume) {
+ tos->entry = qlist_next(tos->entry);
+ }
+ } else {
+ ret = NULL;
+ }
if (consume) {
- tos->entry = qlist_next(tos->entry);
tos->index++;
}
}