1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-30 13:01:23 +03:00

channels: Use ssize_t for to_read

Fixes T188

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
Andreas Schneider
2019-10-31 13:31:46 +01:00
parent 8d671efdbd
commit 07a57b74ba

View File

@@ -2979,7 +2979,7 @@ int ssh_channel_read_nonblocking(ssh_channel channel,
int is_stderr) int is_stderr)
{ {
ssh_session session; ssh_session session;
int to_read; ssize_t to_read;
int rc; int rc;
int blocking; int blocking;
@@ -3003,12 +3003,12 @@ int ssh_channel_read_nonblocking(ssh_channel channel,
return to_read; /* may be an error code */ return to_read; /* may be an error code */
} }
if (to_read > (int)count) { if ((size_t)to_read > count) {
to_read = (int)count; to_read = (ssize_t)count;
} }
blocking = ssh_is_blocking(session); blocking = ssh_is_blocking(session);
ssh_set_blocking(session, 0); 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); ssh_set_blocking(session,blocking);
return rc; return rc;