From 22dcada22d4fee49a10c9e2fdbee9245d105c9bd Mon Sep 17 00:00:00 2001 From: John Safranek Date: Wed, 23 Sep 2026 10:20:51 -0700 Subject: [PATCH] echoserver: check the id before the legacy claim The legacy claim in ssh_worker() now takes the channel id as part of its condition and marks the session connected only once the id is stored, the same order wsShellStartCb() uses. Issue: CID-656285 --- examples/echoserver/echoserver.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/echoserver/echoserver.c b/examples/echoserver/echoserver.c index 39c240191..624701159 100644 --- a/examples/echoserver/echoserver.c +++ b/examples/echoserver/echoserver.c @@ -1164,10 +1164,11 @@ static int ssh_worker(thread_ctx_t* threadCtx) sessionChannel = wolfSSH_ChannelNext(ssh, NULL); if (canServe && sessionChannel != NULL - && sessionChannel->sessionGranted) { + && sessionChannel->sessionGranted + && wolfSSH_ChannelGetId(sessionChannel, + &threadCtx->shellCtx.channelId, + WS_CHANNEL_ID_SELF) == WS_SUCCESS) { threadCtx->shellCtx.state = APP_STATE_CONNECTED; - wolfSSH_ChannelGetId(sessionChannel, - &threadCtx->shellCtx.channelId, WS_CHANNEL_ID_SELF); } }