aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2012-10-05 11:17:06 +0200
committerAndreas Schneider <asn@cryptomilk.org>2012-10-05 11:17:06 +0200
commitceb8072b34a581eb72ed43f7f7ce78fd9b0ea708 (patch)
treee6fd65725cc9a9bf38902c5ccfd002aeeaed9f57
parent656fd60110b73b3fc56c8c407b12a68be7ca67ff (diff)
downloadlibssh-ceb8072b34a581eb72ed43f7f7ce78fd9b0ea708.tar.gz
libssh-ceb8072b34a581eb72ed43f7f7ce78fd9b0ea708.tar.xz
libssh-ceb8072b34a581eb72ed43f7f7ce78fd9b0ea708.zip
channel: Fix a possible null pointer dereference.
-rw-r--r--src/channels.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/channels.c b/src/channels.c
index 1b7caa2f..6a81e377 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -2500,7 +2500,7 @@ error:
*/
int channel_read_buffer(ssh_channel channel, ssh_buffer buffer, uint32_t count,
int is_stderr) {
- ssh_session session=channel->session;
+ ssh_session session;
char buffer_tmp[8192];
int r;
uint32_t total=0;
@@ -2508,6 +2508,8 @@ int channel_read_buffer(ssh_channel channel, ssh_buffer buffer, uint32_t count,
if(channel == NULL) {
return SSH_ERROR;
}
+ session = channel->session;
+
if(buffer == NULL) {
ssh_set_error_invalid(channel->session);
return SSH_ERROR;