mirror of https://github.com/wolfSSL/wolfssh.git
internal: check ssh in SendChannelTerminalResize
It was the one channel sender that read ssh->defaultPeerChannelId without a NULL check. It now returns WS_BAD_ARGUMENT for a NULL ssh and logs entry and exit like its siblings. - add TestTerminalResizeNullSsh to regress.test Issue: F-14769pull/1352/head
parent
d38e40bc8b
commit
fb019d5c9d
|
|
@ -24593,6 +24593,11 @@ int SendChannelTerminalResize(WOLFSSH* ssh, word32 columns, word32 rows,
|
|||
const char* cType = "window-change";
|
||||
word32 typeSz = 0;
|
||||
|
||||
WLOG(WS_LOG_DEBUG, "Entering SendChannelTerminalResize()");
|
||||
|
||||
if (ssh == NULL)
|
||||
ret = WS_BAD_ARGUMENT;
|
||||
|
||||
if (ret == WS_SUCCESS) {
|
||||
channel = ChannelFind(ssh,
|
||||
ssh->defaultPeerChannelId, WS_CHANNEL_ID_PEER);
|
||||
|
|
@ -24641,6 +24646,7 @@ int SendChannelTerminalResize(WOLFSSH* ssh, word32 columns, word32 rows,
|
|||
if (ret == WS_SUCCESS)
|
||||
ret = wolfSSH_SendPacket(ssh);
|
||||
|
||||
WLOG(WS_LOG_DEBUG, "Leaving SendChannelTerminalResize(), ret = %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15394,6 +15394,12 @@ static void TestTerminalResizeBlockedAfterDisconnect(void)
|
|||
wolfSSH_free(ssh);
|
||||
wolfSSH_CTX_free(ctx);
|
||||
}
|
||||
|
||||
static void TestTerminalResizeNullSsh(void)
|
||||
{
|
||||
AssertIntEQ(SendChannelTerminalResize(NULL, 80, 24, 0, 0),
|
||||
WS_BAD_ARGUMENT);
|
||||
}
|
||||
#endif /* WOLFSSH_TERM && !NO_FILESYSTEM */
|
||||
#endif /* !NO_WOLFSSH_CLIENT */
|
||||
|
||||
|
|
@ -21087,6 +21093,7 @@ int main(int argc, char** argv)
|
|||
#if defined(WOLFSSH_TERM) && !defined(NO_FILESYSTEM) \
|
||||
&& !defined(NO_WOLFSSH_CLIENT)
|
||||
TestTerminalResizeBlockedAfterDisconnect();
|
||||
TestTerminalResizeNullSsh();
|
||||
#endif
|
||||
#if !(defined(WOLFSSH_NO_RSA) && defined(WOLFSSH_NO_ECDSA_SHA2_NISTP256))
|
||||
TestClientBuffersIdempotent();
|
||||
|
|
|
|||
Loading…
Reference in New Issue