Commit 56c0922216 for asterisk.org
commit 56c0922216f0b6c3815a5c9131c003179487aff3
Author: George Joseph <gjoseph@sangoma.com>
Date: Thu Aug 13 06:07:19 2026 -0600
res_http_websocket: Check for client before handling PONG frames.
websocket_handled_pong_or_close() now checks that session->client is valid
before trying to check missed_pong_count.
Resolves: #2085
diff --git a/res/res_http_websocket.c b/res/res_http_websocket.c
index 1fe9b4893e..47e793bce3 100644
--- a/res/res_http_websocket.c
+++ b/res/res_http_websocket.c
@@ -510,7 +510,7 @@ static int websocket_handled_pong_or_close(struct ast_websocket *session, char *
/*
* If it's from our own PING, reset the missed count.
*/
- if (session->client->missed_pong_count
+ if (session->client && session->client->missed_pong_count
&& payload_len == WS_PING_PAYLOAD_LEN
&& strncmp(payload, WS_PING_PAYLOAD, payload_len) == 0) {
int mpc = session->client->missed_pong_count;
@@ -518,10 +518,8 @@ static int websocket_handled_pong_or_close(struct ast_websocket *session, char *
session->client->missed_pong_count = 0;
SCOPE_EXIT_RTN_VALUE(1, "%s: Received PONG from our own PING. Missed count was: %d. Cleared.\n",
WS_SESSION_REMOTE(session), mpc);
- } else {
- SCOPE_EXIT_RTN_VALUE(0, "%s: Received PONG. Passing up to client.\n", WS_SESSION_REMOTE(session));
-
}
+ SCOPE_EXIT_RTN_VALUE(0, "%s: Received PONG. Passing up to client.\n", WS_SESSION_REMOTE(session));
}
if (opcode == AST_WEBSOCKET_OPCODE_CLOSE) {