mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-05 04:40:31 +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>
(cherry picked from commit 9c19ba7f33)
(cherry picked from commit d58a4cbd4047ea3aa9d41a820e1978b5f0c49ea5)
This commit is contained in:
committed by
Andreas Schneider
parent
2dffb97007
commit
8b8584ce5f
@@ -3403,9 +3403,15 @@ int ssh_channel_select(ssh_channel *readchans, ssh_channel *writechans,
|
||||
firstround=0;
|
||||
} while(1);
|
||||
|
||||
memcpy(readchans, rchans, (count_ptrs(rchans) + 1) * sizeof(ssh_channel ));
|
||||
memcpy(writechans, wchans, (count_ptrs(wchans) + 1) * sizeof(ssh_channel ));
|
||||
memcpy(exceptchans, echans, (count_ptrs(echans) + 1) * sizeof(ssh_channel ));
|
||||
if (readchans != &dummy) {
|
||||
memcpy(readchans, rchans, (count_ptrs(rchans) + 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(wchans);
|
||||
SAFE_FREE(echans);
|
||||
|
||||
Reference in New Issue
Block a user