From: Gerd Hoffmann Date: Thu, 24 May 2012 08:55:01 +0000 (+0200) Subject: vnc: fix segfault in vnc_display_pw_expire() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=1643f2b232628905e8f32965ff36a87bd53b93c5;p=qemu.git vnc: fix segfault in vnc_display_pw_expire() NULL pointer dereference in case no vnc server is configured. Catch this and return -EINVAL like vnc_display_password() does. Signed-off-by: Gerd Hoffmann Signed-off-by: Anthony Liguori --- diff --git a/ui/vnc.c b/ui/vnc.c index be384a5315..54bc5adab6 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -2849,6 +2849,10 @@ int vnc_display_pw_expire(DisplayState *ds, time_t expires) { VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display; + if (!vs) { + return -EINVAL; + } + vs->expires = expires; return 0; }