Skip to content

Commit

Permalink
vnc: fix segmentation fault when invalid vnc parameters are specified
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
gongleiarei authored and kraxel committed Mar 12, 2015
1 parent b3c33f9 commit 81607cb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ui/vnc.c
Expand Up @@ -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);
Expand Down

0 comments on commit 81607cb

Please sign in to comment.