diff mbox

[RESEND,1.1] vnc: fix segfault in vnc_display_pw_expire()

Message ID 1337849701-21906-1-git-send-email-kraxel@redhat.com
State New
Headers show

Commit Message

Gerd Hoffmann May 24, 2012, 8:55 a.m. UTC
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>
---
 ui/vnc.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Comments

Anthony Liguori May 30, 2012, 6:45 a.m. UTC | #1
On 05/24/2012 04:55 PM, Gerd Hoffmann wrote:
> 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>

Applied.  Thanks.

Regards,

Anthony Liguori

> ---
>   ui/vnc.c |    4 ++++
>   1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/ui/vnc.c b/ui/vnc.c
> index be384a5..54bc5ad 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;
>   }
diff mbox

Patch

diff --git a/ui/vnc.c b/ui/vnc.c
index be384a5..54bc5ad 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;
 }