libssh/libssh-channel-close.patch
2013-07-16 08:36:27 +02:00

34 lines
768 B
Diff

From 068ab9f61196b01235173623c1cca3143cf1d43a Mon Sep 17 00:00:00 2001
From: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Date: Sat, 13 Jul 2013 14:13:52 +0400
Subject: [PATCH] Check for NULL pointers in ssh_channel_close
---
src/channels.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/channels.c b/src/channels.c
index 214485c..3fac10e 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -1080,9 +1080,15 @@ error:
* @see channel_eof()
*/
int ssh_channel_close(ssh_channel channel){
- ssh_session session = channel->session;
+ ssh_session session;
int rc = 0;
+ if (channel == NULL) {
+ return SSH_ERROR;
+ }
+
+ session = channel->session;
+
enter_function();
if (channel->local_eof == 0) {
--
1.8.3.1