aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2011-02-18 18:03:37 +0100
committerAndreas Schneider <asn@cryptomilk.org>2011-02-18 18:03:37 +0100
commit5cc2e69d0dcc161b8fa119cb7fe5f92966814f05 (patch)
treeac4f1e658aedd5bc1fad235f9b9c61f04d5aa94d /src
parent23b3c46fd60201147c8a40d4dae5fe86f36bfd86 (diff)
downloadlibssh-5cc2e69d0dcc161b8fa119cb7fe5f92966814f05.tar.gz
libssh-5cc2e69d0dcc161b8fa119cb7fe5f92966814f05.tar.xz
libssh-5cc2e69d0dcc161b8fa119cb7fe5f92966814f05.zip
channel: Fixed a possible NULL pointe dereference.
Diffstat (limited to 'src')
-rw-r--r--src/channels.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/channels.c b/src/channels.c
index a8aaa5e..f0cc84a 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -1126,9 +1126,7 @@ int channel_write_common(ssh_channel channel, const void *data,
ssh_session session;
int origlen = len;
size_t effectivelen;
- /* handle the max packet len from remote side, be nice */
- /* 10 bytes for the headers */
- size_t maxpacketlen = channel->remote_maxpacket - 10;
+ size_t maxpacketlen;
if(channel == NULL || data == NULL) {
return -1;
@@ -1140,6 +1138,12 @@ int channel_write_common(ssh_channel channel, const void *data,
}
enter_function();
+ /*
+ * Handle the max packet len from remote side, be nice
+ * 10 bytes for the headers
+ */
+ maxpacketlen = channel->remote_maxpacket - 10;
+
if (channel->local_eof) {
ssh_set_error(session, SSH_REQUEST_DENIED,
"Can't write to channel %d:%d after EOF was sent",