qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gonglei <arei.gonglei@huawei.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Anthony Liguori <aliguori@amazon.com>
Subject: [Qemu-devel] [PULL 7/7] vnc: fix segmentation fault when invalid vnc parameters are specified
Date: Thu, 12 Mar 2015 10:00:25 +0100	[thread overview]
Message-ID: <1426150825-782-8-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1426150825-782-1-git-send-email-kraxel@redhat.com>

From: Gonglei <arei.gonglei@huawei.com>

Reproducer:
 #./qemu-system-x86_64 -vnc :0,ip
qemu-system-x86_64: -vnc :1,ip: Invalid parameter 'ip'
Segmentation fault (core dumped)

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/vnc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/ui/vnc.c b/ui/vnc.c
index 1e95445..6f9b718 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -3703,8 +3703,13 @@ QemuOpts *vnc_parse_func(const char *str)
 {
     QemuOptsList *olist = qemu_find_opts("vnc");
     QemuOpts *opts = qemu_opts_parse(olist, str, 1);
-    const char *id = qemu_opts_id(opts);
+    const char *id;
 
+    if (!opts) {
+        return NULL;
+    }
+
+    id = qemu_opts_id(opts);
     if (!id) {
         /* auto-assign id if not present */
         vnc_auto_assign_id(olist, opts);
-- 
1.8.3.1

  parent reply	other threads:[~2015-03-12  9:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-12  9:00 [Qemu-devel] [PULL 0/7] vnc patch queue Gerd Hoffmann
2015-03-12  9:00 ` [Qemu-devel] [PULL 1/7] vnc: drop display+ws_display from VncDisplay Gerd Hoffmann
2015-03-12  9:00 ` [Qemu-devel] [PULL 2/7] vnc: remove dead code Gerd Hoffmann
2015-03-12  9:00 ` [Qemu-devel] [PULL 3/7] vnc: switch to inet_listen_opts Gerd Hoffmann
2015-03-12  9:00 ` [Qemu-devel] [PULL 4/7] ui: fix regression in x509verify parameter for VNC server Gerd Hoffmann
2015-03-12  9:00 ` [Qemu-devel] [PULL 5/7] ui/console: fix OVERFLOW_BEFORE_WIDEN Gerd Hoffmann
2015-03-12  9:00 ` [Qemu-devel] [PULL 6/7] vnc: avoid possible file handler leak Gerd Hoffmann
2015-03-12  9:00 ` Gerd Hoffmann [this message]
2015-03-12 11:38 ` [Qemu-devel] [PULL 0/7] vnc patch queue Peter Maydell

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=1426150825-782-8-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=aliguori@amazon.com \
    --cc=arei.gonglei@huawei.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).