mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 10:40:27 +09:00
connector: Fix cycle condition to avoid possible underflow
*** CID 1548868: Insecure data handling (INTEGER_OVERFLOW) Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Sahana Prasad <sahana@redhat.com> Reviewed-by: Eshan Kelkar <eshankelkar@galorithm.com>
This commit is contained in:
committed by
Sahana Prasad
parent
17a8a8b3c3
commit
af8de95805
@@ -291,9 +291,11 @@ static void ssh_connector_fd_in_cb(ssh_connector connector)
|
|||||||
* Loop around write in case the write blocks even for CHUNKSIZE
|
* Loop around write in case the write blocks even for CHUNKSIZE
|
||||||
* bytes
|
* bytes
|
||||||
*/
|
*/
|
||||||
while (total != r) {
|
while (total < r) {
|
||||||
w = ssh_connector_fd_write(connector, buffer + total, r - total);
|
w = ssh_connector_fd_write(connector,
|
||||||
if (w < 0){
|
buffer + total,
|
||||||
|
r - total);
|
||||||
|
if (w < 0) {
|
||||||
ssh_connector_except(connector, connector->out_fd);
|
ssh_connector_except(connector, connector->out_fd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user