Skip to content

Commit 13ffca4

Browse files
committed
Fix null dereference after failed channel lookup
When looking up the channel object for the current channel ID, if the lookup failed, we still checked if the channel had an EOF with a null pointer. That function, does check for NULL and error, but it is better to error out sooner. Affected function: ReceiveScpMessage.
1 parent 05ec832 commit 13ffca4

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/wolfscp.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,9 +1423,10 @@ int ReceiveScpMessage(WOLFSSH* ssh)
14231423
if (err == 0) {
14241424
WOLFSSH_CHANNEL* channel;
14251425
channel = wolfSSH_ChannelFind(ssh, lastChannel, WS_CHANNEL_ID_SELF);
1426-
if (channel == NULL)
1426+
if (channel == NULL) {
14271427
ret = WS_INVALID_CHANID;
1428-
if (wolfSSH_ChannelGetEof(channel)) {
1428+
}
1429+
else if (wolfSSH_ChannelGetEof(channel)) {
14291430
return WS_EOF;
14301431
}
14311432
}

0 commit comments

Comments
 (0)