aboutsummaryrefslogtreecommitdiffstats
path: root/modules/websocket.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2026-03-14 07:38:40 +0000
committerGravatar Sadie Powell2026-03-14 07:39:49 +0000
commit13054387b49d90f6f0a8f431a72bb9006bda5813 (patch)
treef6dc2e0edfc2aa2fd29a13e910fcdc74df28748e /modules/websocket.cpp
parentRewrite portparser and move to stringutils. (diff)
Fix a crash caused by weirdly casting a pointer to an I/O handler.
Diffstat (limited to 'modules/websocket.cpp')
-rw-r--r--modules/websocket.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/modules/websocket.cpp b/modules/websocket.cpp
index 2c6b135ac..cde1ad433 100644
--- a/modules/websocket.cpp
+++ b/modules/websocket.cpp
@@ -333,8 +333,8 @@ class WebSocketHook final
else if (sock->type == StreamSocket::SS_USER && config.nativeping)
{
// Pong reply on user socket; reset their idle time.
- auto* lio = reinterpret_cast<LocalUserIO*>(sock);
- lio->user->lastping = 1;
+ auto* luser = sock->GetData<LocalUserIO>()->user;
+ luser->lastping = 1;
}
return 1;
}
@@ -427,10 +427,7 @@ class WebSocketHook final
LocalUser* luser = nullptr;
if (sock->type == StreamSocket::SS_USER)
- {
- auto* lio = reinterpret_cast<LocalUserIO*>(sock);
- luser = lio ? lio->user : nullptr;
- }
+ luser = sock->GetData<LocalUserIO>()->user;
bool allowedorigin = false;
HTTPHeaderFinder originheader;