From 726748093336e9c1d0e7b70d7180b2aa8196061b Mon Sep 17 00:00:00 2001
From: mayp <mayanping@ncti-gba.cn>
Date: Mon, 19 Sep 2022 19:01:08 +0800
Subject: [PATCH] [mod_wstunnel] fix crash with bad hybivers (fixes #3165) modified:
 src/mod_wstunnel.c

---
 src/mod_wstunnel.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/mod_wstunnel.c b/src/mod_wstunnel.c
index 6d17d4d..97b89f0 100644
--- a/src/mod_wstunnel.c
+++ b/src/mod_wstunnel.c
@@ -483,7 +483,10 @@ static handler_t wstunnel_handler_setup (request_st * const r, plugin_data * con
     hctx->errh = r->conf.errh;/*(for mod_wstunnel-specific DEBUG_* macros)*/
     hctx->conf = p->conf; /*(copies struct)*/
     hybivers = wstunnel_check_request(r, hctx);
-    if (hybivers < 0) return HANDLER_FINISHED;
+    if (hybivers < 0) {
+        r->handler_module = NULL;
+        return HANDLER_FINISHED;
+    }
     hctx->hybivers = hybivers;
     if (0 == hybivers) {
         DEBUG_LOG_INFO("WebSocket Version = %s", "hybi-00");
-- 
2.33.0

