From 001b3010a6acb81842c343ae0e33c7c87e8784e5 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Thu, 19 Oct 2017 11:23:51 +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 d60d5f2e..345e1b85 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),