[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 01/27] qga: Fix crash on non-dictionary QMP argume
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PULL v2 01/27] qga: Fix crash on non-dictionary QMP argument |
Date: |
Sun, 5 Mar 2017 09:35:32 +0100 |
The value of key 'arguments' must be a JSON object. qemu-ga neglects
to check, and crashes. To reproduce, send
{ 'execute': 'guest-sync', 'arguments': [] }
to qemu-ga.
do_qmp_dispatch() uses qdict_get_qdict() to get the arguments. When
not a JSON object, this gets a null pointer, which flows through the
generated marshalling function to qobject_input_visitor_new(), where
it fails the assertion. qmp_dispatch_check_obj() needs to catch this
error.
QEMU isn't affected, because it runs qmp_check_input_obj() first,
which basically duplicates qmp_dispatch_check_obj()'s checks, plus the
missing one.
Fix by copying the missing one from qmp_check_input_obj() to
qmp_dispatch_check_obj().
Signed-off-by: Markus Armbruster <address@hidden>
Cc: Michael Roth <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>
---
qapi/qmp-dispatch.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c
index 48bec20..621922f 100644
--- a/qapi/qmp-dispatch.c
+++ b/qapi/qmp-dispatch.c
@@ -47,7 +47,13 @@ static QDict *qmp_dispatch_check_obj(const QObject *request,
Error **errp)
return NULL;
}
has_exec_key = true;
- } else if (strcmp(arg_name, "arguments")) {
+ } else if (!strcmp(arg_name, "arguments")) {
+ if (qobject_type(arg_obj) != QTYPE_QDICT) {
+ error_setg(errp, QERR_QMP_BAD_INPUT_OBJECT_MEMBER,
+ "arguments", "object");
+ return NULL;
+ }
+ } else {
error_setg(errp, QERR_QMP_EXTRA_MEMBER, arg_name);
return NULL;
}
--
2.7.4
- [Qemu-devel] [PULL v2 00/27] QAPI patches for 2017-02-28, Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 11/27] qapi: Clean up after commit 3d344c2, Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 06/27] qapi-introspect: Mangle --prefix argument properly for C, Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 12/27] qapi: Make QObject input visitor set *list reliably, Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 03/27] qmp-test: New, covering basic QMP protocol, Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 02/27] libqtest: Work around a "QMP wants a newline" bug, Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 09/27] qmp: Eliminate silly QERR_QMP_* macros, Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 01/27] qga: Fix crash on non-dictionary QMP argument,
Markus Armbruster <=
- [Qemu-devel] [PULL v2 23/27] test-qobject-input-visitor: Cover missing nested struct member, Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 17/27] test-qobject-input-visitor: Use strict visitor, Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 26/27] qapi: Fix object input visit beyond end of list, Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 10/27] qapi: Improve a QObject input visitor error message, Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 04/27] qmp: Dumb down how we run QMP command registration, Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 16/27] qom: Make object_property_set_qobject()'s input visitor strict, Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 13/27] qapi: Improve qobject input visitor error reporting, Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 14/27] qapi: Drop string input visitor method optional(), Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 07/27] qmp: Clean up how we enforce capability negotiation, Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 08/27] qmp: Drop duplicated QMP command object checks, Markus Armbruster, 2017/03/05