1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

sshd: fix NULL vhd protection

This commit is contained in:
Andy Green 2017-10-19 11:23:51 +08:00
parent 79326e4f07
commit 001b3010a6

View file

@ -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),