[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] channels: properly set rc to length


It was observed that in case the returned length of ssh_buffer_get_len
was 0 the return value was not properly set to that value. This leads to
timeout failures.

Signed-off-by: Heiko Thiery <heiko.thiery@xxxxxxxxx>
---
 src/channels.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/channels.c b/src/channels.c
index 20cafeac..ff6465a6 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -3118,11 +3118,10 @@ int ssh_channel_poll_timeout(ssh_channel channel, int timeout, int is_stderr)
         goto out;
     }
     len = ssh_buffer_get_len(stdbuf);
+    rc = (int)len;
     if (len > 0) {
         if (len > INT_MAX) {
             rc = SSH_ERROR;
-        } else {
-            rc = (int)len;
         }
         goto out;
     }
-- 
2.20.1


References:
[RFC] channels regression issueHeiko Thiery <heiko.thiery@xxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org