mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-09 09:54:25 +09:00
channels: Avoid out-of-bounds writes
CID 1470005 Thanks coverity Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Norbert Pocs <npocs@redhat.com>
This commit is contained in:
@@ -3584,9 +3584,15 @@ int ssh_channel_select(ssh_channel *readchans, ssh_channel *writechans,
|
|||||||
firstround=0;
|
firstround=0;
|
||||||
} while(1);
|
} while(1);
|
||||||
|
|
||||||
memcpy(readchans, rchans, (count_ptrs(rchans) + 1) * sizeof(ssh_channel ));
|
if (readchans != &dummy) {
|
||||||
memcpy(writechans, wchans, (count_ptrs(wchans) + 1) * sizeof(ssh_channel ));
|
memcpy(readchans, rchans, (count_ptrs(rchans) + 1) * sizeof(ssh_channel));
|
||||||
memcpy(exceptchans, echans, (count_ptrs(echans) + 1) * sizeof(ssh_channel ));
|
}
|
||||||
|
if (writechans != &dummy) {
|
||||||
|
memcpy(writechans, wchans, (count_ptrs(wchans) + 1) * sizeof(ssh_channel));
|
||||||
|
}
|
||||||
|
if (exceptchans != &dummy) {
|
||||||
|
memcpy(exceptchans, echans, (count_ptrs(echans) + 1) * sizeof(ssh_channel));
|
||||||
|
}
|
||||||
SAFE_FREE(rchans);
|
SAFE_FREE(rchans);
|
||||||
SAFE_FREE(wchans);
|
SAFE_FREE(wchans);
|
||||||
SAFE_FREE(echans);
|
SAFE_FREE(echans);
|
||||||
|
|||||||
Reference in New Issue
Block a user