qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: qemu-devel@nongnu.org
Cc: armbru@redhat.com
Subject: [Qemu-devel] [PATCH 4/4] QMP: Check "arguments" member's type
Date: Wed,  7 Apr 2010 15:25:10 -0300	[thread overview]
Message-ID: <1270664710-3948-5-git-send-email-lcapitulino@redhat.com> (raw)
In-Reply-To: <1270664710-3948-1-git-send-email-lcapitulino@redhat.com>

Otherwise the following input crashes QEMU:

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

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 monitor.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/monitor.c b/monitor.c
index cd350d6..91d7da5 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4522,6 +4522,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);
-- 
1.7.0.4.297.g6555b1

  parent reply	other threads:[~2010-04-07 18:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-07 18:25 [Qemu-devel] [PATCH 0/4]: QMP: Fix segfault in bad input Luiz Capitulino
2010-04-07 18:25 ` [Qemu-devel] [PATCH 1/4] QError: New QERR_QMP_BAD_INPUT_OBJECT_MEMBER Luiz Capitulino
2010-04-07 18:25 ` [Qemu-devel] [PATCH 2/4] QMP: Use QERR_QMP_BAD_INPUT_OBJECT_MEMBER Luiz Capitulino
2010-04-07 18:25 ` [Qemu-devel] [PATCH 3/4] QError: Improve QERR_QMP_BAD_INPUT_OBJECT desc Luiz Capitulino
2010-04-07 18:25 ` Luiz Capitulino [this message]
2010-04-20  8:53 ` [Qemu-devel] [PATCH 0/4]: QMP: Fix segfault in bad input Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1270664710-3948-5-git-send-email-lcapitulino@redhat.com \
    --to=lcapitulino@redhat.com \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).