From 1643f2b232628905e8f32965ff36a87bd53b93c5 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Thu, 24 May 2012 10:55:01 +0200 Subject: 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 --- ui/vnc.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ui') 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; } -- cgit v1.2.3