|
|
68eb44 |
From baadc811a703b9a6dec655c7afb3218d8cff51fa Mon Sep 17 00:00:00 2001
|
|
|
68eb44 |
From: Daniel Stenberg <daniel@haxx.se>
|
|
|
68eb44 |
Date: Sun, 16 Mar 2014 20:02:37 +0100
|
|
|
68eb44 |
Subject: [PATCH 11/11] channel_receive_window_adjust: store windows size always
|
|
|
68eb44 |
|
|
|
68eb44 |
Avoid it sometimes returning without storing it, leaving calling
|
|
|
68eb44 |
functions with unknown content!
|
|
|
68eb44 |
|
|
|
68eb44 |
Detected by clang-analyzer
|
|
|
68eb44 |
|
|
|
68eb44 |
[upstream commit fcb601da7b37c6e9bbcd264199597e2ddb7bc347]
|
|
|
68eb44 |
|
|
|
68eb44 |
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
|
|
68eb44 |
---
|
|
|
68eb44 |
src/channel.c | 11 ++++-------
|
|
|
68eb44 |
1 files changed, 4 insertions(+), 7 deletions(-)
|
|
|
68eb44 |
|
|
|
68eb44 |
diff --git a/src/channel.c b/src/channel.c
|
|
|
68eb44 |
index 36c75d2..1d074df 100644
|
|
|
68eb44 |
--- a/src/channel.c
|
|
|
68eb44 |
+++ b/src/channel.c
|
|
|
68eb44 |
@@ -1,6 +1,6 @@
|
|
|
68eb44 |
/* Copyright (c) 2004-2007 Sara Golemon <sarag@libssh2.org>
|
|
|
68eb44 |
* Copyright (c) 2005 Mikhail Gusarov <dottedmag@dottedmag.net>
|
|
|
68eb44 |
- * Copyright (c) 2008-2011 by Daniel Stenberg
|
|
|
68eb44 |
+ * Copyright (c) 2008-2014 by Daniel Stenberg
|
|
|
68eb44 |
*
|
|
|
68eb44 |
* All rights reserved.
|
|
|
68eb44 |
*
|
|
|
68eb44 |
@@ -1544,6 +1544,9 @@ _libssh2_channel_receive_window_adjust(LIBSSH2_CHANNEL * channel,
|
|
|
68eb44 |
{
|
|
|
68eb44 |
int rc;
|
|
|
68eb44 |
|
|
|
68eb44 |
+ if(store)
|
|
|
68eb44 |
+ *store = channel->remote.window_size;
|
|
|
68eb44 |
+
|
|
|
68eb44 |
if (channel->adjust_state == libssh2_NB_state_idle) {
|
|
|
68eb44 |
if (!force
|
|
|
68eb44 |
&& (adjustment + channel->adjust_queue <
|
|
|
68eb44 |
@@ -1553,14 +1556,10 @@ _libssh2_channel_receive_window_adjust(LIBSSH2_CHANNEL * channel,
|
|
|
68eb44 |
"for channel %lu/%lu",
|
|
|
68eb44 |
adjustment, channel->local.id, channel->remote.id);
|
|
|
68eb44 |
channel->adjust_queue += adjustment;
|
|
|
68eb44 |
- if(store)
|
|
|
68eb44 |
- *store = channel->remote.window_size;
|
|
|
68eb44 |
return 0;
|
|
|
68eb44 |
}
|
|
|
68eb44 |
|
|
|
68eb44 |
if (!adjustment && !channel->adjust_queue) {
|
|
|
68eb44 |
- if(store)
|
|
|
68eb44 |
- *store = channel->remote.window_size;
|
|
|
68eb44 |
return 0;
|
|
|
68eb44 |
}
|
|
|
68eb44 |
|
|
|
68eb44 |
@@ -1598,8 +1597,6 @@ _libssh2_channel_receive_window_adjust(LIBSSH2_CHANNEL * channel,
|
|
|
68eb44 |
|
|
|
68eb44 |
channel->adjust_state = libssh2_NB_state_idle;
|
|
|
68eb44 |
|
|
|
68eb44 |
- if(store)
|
|
|
68eb44 |
- *store = channel->remote.window_size;
|
|
|
68eb44 |
return 0;
|
|
|
68eb44 |
}
|
|
|
68eb44 |
|
|
|
68eb44 |
--
|
|
|
68eb44 |
1.7.1
|
|
|
68eb44 |
|