QMP: Check "arguments" member's type
authorLuiz Capitulino <lcapitulino@redhat.com>
Tue, 6 Apr 2010 19:39:42 +0000 (16:39 -0300)
committerLuiz Capitulino <lcapitulino@redhat.com>
Mon, 26 Apr 2010 14:17:19 +0000 (11:17 -0300)
Otherwise the following input crashes QEMU:

{ "execute": "migrate", "arguments": "tcp:0:4446" }

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
monitor.c

index 0611b29d1a363fa8c535e4097d47814fcb8a9d52..ef8429861b5a0b18c2cabcec786bd368d4b9011a 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -4437,6 +4437,9 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
     obj = qdict_get(input, "arguments");
     if (!obj) {
         args = qdict_new();
+    } else if (qobject_type(obj) != QTYPE_QDICT) {
+        qerror_report(QERR_QMP_BAD_INPUT_OBJECT_MEMBER, "arguments", "object");
+        goto err_input;
     } else {
         args = qobject_to_qdict(obj);
         QINCREF(args);