aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGonglei <arei.gonglei@huawei.com>2015-03-12 15:33:45 +0800
committerGerd Hoffmann <kraxel@redhat.com>2015-03-12 09:09:10 +0100
commit81607cbfa433272d1f09bd0f0ae6c3b14f818972 (patch)
tree586a9c8c5fe987c1b514f9bd42be1762b9eaacc1
parentb3c33f91732ea32e7a8391c5e61c3fc02308d822 (diff)
vnc: fix segmentation fault when invalid vnc parameters are specified
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>
-rw-r--r--ui/vnc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ui/vnc.c b/ui/vnc.c
index 1e95445c4a..6f9b718814 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);