Skip to contentSkip to conversation

vnc: fix segfault in vnc_display_pw_expire()

PATCH Superseded Gerd Hoffmann 1 participant 1 message May 9, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 ui/vnc.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
ui/vnc.c +4 -0
index deb9ecd..4408110 100644
@@ -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;
 }
Signature · 1 line
1.7.1