aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2012-10-08 19:52:20 +0200
committerAndreas Schneider <asn@cryptomilk.org>2012-10-09 11:09:34 +0200
commitbb2848de5ae649e12e8205e99992ff81087d583e (patch)
tree1521535a99e0e392221d725a95f9edb687a24522 /src
parent6acce40a28b4f74806e1928ec6bdbe2d9da43b2c (diff)
downloadlibssh-bb2848de5ae649e12e8205e99992ff81087d583e.tar.gz
libssh-bb2848de5ae649e12e8205e99992ff81087d583e.tar.xz
libssh-bb2848de5ae649e12e8205e99992ff81087d583e.zip
channels: Check return values of buffer functions.
Found by Coverity.
Diffstat (limited to 'src')
-rw-r--r--src/channels.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/channels.c b/src/channels.c
index 6a81e377..027fe356 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -654,6 +654,7 @@ SSH_PACKET_CALLBACK(channel_rcv_request) {
ssh_string request_s;
char *request;
uint32_t status;
+ int rc;
(void)user;
(void)type;
@@ -816,8 +817,14 @@ SSH_PACKET_CALLBACK(channel_rcv_request) {
if(strcmp(request,"keepalive@openssh.com")==0){
SAFE_FREE(request);
ssh_log(session, SSH_LOG_PROTOCOL,"Responding to Openssh's keepalive");
- buffer_add_u8(session->out_buffer, SSH2_MSG_CHANNEL_FAILURE);
- buffer_add_u32(session->out_buffer, htonl(channel->remote_channel));
+ rc = buffer_add_u8(session->out_buffer, SSH2_MSG_CHANNEL_FAILURE);
+ if (rc < 0) {
+ return SSH_PACKET_USED;
+ }
+ rc = buffer_add_u32(session->out_buffer, htonl(channel->remote_channel));
+ if (rc < 0) {
+ return SSH_PACKET_USED;
+ }
packet_send(session);
leave_function();
return SSH_PACKET_USED;