From da38a17a31ee3e3bd5169b4734d1680c8aca12f9 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Mon, 19 Mar 2018 07:59:42 +0800 Subject: [PATCH] coverity 188321: reject wsi with NULL vhost earlier --- lib/server/server.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/server/server.c b/lib/server/server.c index ade2e06e..616ac737 100644 --- a/lib/server/server.c +++ b/lib/server/server.c @@ -383,7 +383,10 @@ lws_http_serve(struct lws *wsi, char *uri, const char *origin, int n; wsi->handling_404 = 0; - if (wsi->vhost && wsi->vhost->error_document_404 && + if (!wsi->vhost) + return -1; + + if (wsi->vhost->error_document_404 && !strcmp(uri, wsi->vhost->error_document_404)) wsi->handling_404 = 1;