mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 02:38:09 +09:00
channel: Fixed a possible NULL pointe dereference.
This commit is contained in:
@@ -1126,9 +1126,7 @@ int channel_write_common(ssh_channel channel, const void *data,
|
|||||||
ssh_session session;
|
ssh_session session;
|
||||||
int origlen = len;
|
int origlen = len;
|
||||||
size_t effectivelen;
|
size_t effectivelen;
|
||||||
/* handle the max packet len from remote side, be nice */
|
size_t maxpacketlen;
|
||||||
/* 10 bytes for the headers */
|
|
||||||
size_t maxpacketlen = channel->remote_maxpacket - 10;
|
|
||||||
|
|
||||||
if(channel == NULL || data == NULL) {
|
if(channel == NULL || data == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
@@ -1140,6 +1138,12 @@ int channel_write_common(ssh_channel channel, const void *data,
|
|||||||
}
|
}
|
||||||
enter_function();
|
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) {
|
if (channel->local_eof) {
|
||||||
ssh_set_error(session, SSH_REQUEST_DENIED,
|
ssh_set_error(session, SSH_REQUEST_DENIED,
|
||||||
"Can't write to channel %d:%d after EOF was sent",
|
"Can't write to channel %d:%d after EOF was sent",
|
||||||
|
|||||||
Reference in New Issue
Block a user