aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2020-01-23 10:20:59 +0100
committerAndreas Schneider <asn@cryptomilk.org>2020-01-23 11:03:44 +0100
commit9a10cef92086d3b22fa4acd9999cf908b7fa7e48 (patch)
tree7bdcdf3d65ab53c7bfc3291eaf895378093b6ee4
parent6fcd0940e38fff46d6a28c47950c5ea127937db6 (diff)
downloadlibssh-9a10cef92086d3b22fa4acd9999cf908b7fa7e48.tar.gz
libssh-9a10cef92086d3b22fa4acd9999cf908b7fa7e48.tar.xz
libssh-9a10cef92086d3b22fa4acd9999cf908b7fa7e48.zip
channels: Fix ssh_channel_poll_timeout() not returing available bytes
Fixes T211 Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> (cherry picked from commit 022409e99c9f6d6f1e540da5c2fa925b72998974)
-rw-r--r--src/channels.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/channels.c b/src/channels.c
index a670d895..05dcf8f6 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -3119,6 +3119,11 @@ int ssh_channel_poll_timeout(ssh_channel channel, int timeout, int is_stderr)
}
len = ssh_buffer_get_len(stdbuf);
if (len > 0) {
+ if (len > INT_MAX) {
+ rc = SSH_ERROR;
+ } else {
+ rc = (int)len;
+ }
goto out;
}
if (channel->remote_eof) {