1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-08-08 19:02:06 +03:00

channel: Fix a possible null pointer dereference.

This commit is contained in:
Andreas Schneider
2012-10-05 11:17:06 +02:00
parent 656fd60110
commit ceb8072b34

View File

@@ -2500,7 +2500,7 @@ error:
*/ */
int channel_read_buffer(ssh_channel channel, ssh_buffer buffer, uint32_t count, int channel_read_buffer(ssh_channel channel, ssh_buffer buffer, uint32_t count,
int is_stderr) { int is_stderr) {
ssh_session session=channel->session; ssh_session session;
char buffer_tmp[8192]; char buffer_tmp[8192];
int r; int r;
uint32_t total=0; uint32_t total=0;
@@ -2508,6 +2508,8 @@ int channel_read_buffer(ssh_channel channel, ssh_buffer buffer, uint32_t count,
if(channel == NULL) { if(channel == NULL) {
return SSH_ERROR; return SSH_ERROR;
} }
session = channel->session;
if(buffer == NULL) { if(buffer == NULL) {
ssh_set_error_invalid(channel->session); ssh_set_error_invalid(channel->session);
return SSH_ERROR; return SSH_ERROR;