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 <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Gerd Hoffmann 2012-05-24 10:55:01 +02:00 committed by Anthony Liguori
parent 1352672860
commit 1643f2b232
1 changed files with 4 additions and 0 deletions

View File

@ -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;
}