From 613ae7921a26461af1122c7b9a1af7c518d009bc Mon Sep 17 00:00:00 2001 From: Andy Green Date: Mon, 19 Mar 2018 07:57:13 +0800 Subject: [PATCH] coverity 188314: reject wsi with NULL vhost earlier --- lib/header.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/header.c b/lib/header.c index 5022f26a..c9f3af3e 100644 --- a/lib/header.c +++ b/lib/header.c @@ -233,8 +233,12 @@ lws_return_http_status(struct lws *wsi, unsigned int code, int n = 0, m = 0, len; char slen[20]; - if (wsi->vhost && - !wsi->handling_404 && + if (!wsi->vhost) { + lwsl_err("%s: wsi not bound to vhost\n", __func__); + + return 1; + } + if (!wsi->handling_404 && wsi->vhost->error_document_404 && code == HTTP_STATUS_NOT_FOUND) /* we should do a redirect, and do the 404 there */