From c890b6f1b5db8601651ca725dd4f9c07c0ab0c75 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Thu, 19 Oct 2017 11:25:48 +0800 Subject: [PATCH] sshd: fix NULL vhd protection --- plugins/ssh-base/sshd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/ssh-base/sshd.c b/plugins/ssh-base/sshd.c index d60d5f2eb..345e1b85a 100644 --- a/plugins/ssh-base/sshd.c +++ b/plugins/ssh-base/sshd.c @@ -2045,14 +2045,12 @@ lws_callback_raw_sshd(struct lws *wsi, enum lws_callback_reasons reason, lws_protocol_vh_priv_get(lws_get_vhost(wsi), pss->vhd->protocol); else - vhd = (struct per_vhost_data__sshd *) + if (lws_get_vhost(wsi)) + vhd = (struct per_vhost_data__sshd *) lws_protocol_vh_priv_get(lws_get_vhost(wsi), lws_vhost_name_to_protocol( lws_get_vhost(wsi), "lws-ssh-base")); - if (!vhd && reason != LWS_CALLBACK_PROTOCOL_INIT) - return -1; - switch ((int)reason) { case LWS_CALLBACK_PROTOCOL_INIT: vhd = lws_protocol_vh_priv_zalloc(lws_get_vhost(wsi),