From 3eae5f8bcad9f865353330eaf9a21614e696a678 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Wed, 9 Feb 2022 11:59:06 +0000 Subject: [PATCH] ss: reject direct protocol metadata if NULL ss wsi The ss wsi may be NULL after any time around the event loop. Make sure we check that before we start trying to use it. --- lib/secure-streams/policy-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/secure-streams/policy-common.c b/lib/secure-streams/policy-common.c index b782c1e5b..a98abaeaf 100644 --- a/lib/secure-streams/policy-common.c +++ b/lib/secure-streams/policy-common.c @@ -177,7 +177,7 @@ lws_ss_get_metadata(struct lws_ss_handle *h, const char *name, return 0; } #if defined(LWS_WITH_SS_DIRECT_PROTOCOL_STR) - if (!(h->policy->flags & LWSSSPOLF_DIRECT_PROTO_STR)) + if (!(h->policy->flags & LWSSSPOLF_DIRECT_PROTO_STR) || !h->wsi) goto bail; n = lws_http_string_to_known_header(name, strlen(name));