From 07a57b74ba0fb98da5dc2682473a60b743c6827d Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 31 Oct 2019 13:31:46 +0100 Subject: [PATCH] channels: Use ssize_t for to_read Fixes T188 Signed-off-by: Andreas Schneider Reviewed-by: Jakub Jelen --- src/channels.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/channels.c b/src/channels.c index ec5850f2..62d9a65e 100644 --- a/src/channels.c +++ b/src/channels.c @@ -2979,7 +2979,7 @@ int ssh_channel_read_nonblocking(ssh_channel channel, int is_stderr) { ssh_session session; - int to_read; + ssize_t to_read; int rc; int blocking; @@ -3003,12 +3003,12 @@ int ssh_channel_read_nonblocking(ssh_channel channel, return to_read; /* may be an error code */ } - if (to_read > (int)count) { - to_read = (int)count; + if ((size_t)to_read > count) { + to_read = (ssize_t)count; } blocking = ssh_is_blocking(session); ssh_set_blocking(session, 0); - rc = ssh_channel_read(channel, dest, to_read, is_stderr); + rc = ssh_channel_read(channel, dest, (uint32_t)to_read, is_stderr); ssh_set_blocking(session,blocking); return rc;