From 253bda4bac7a062f2ab1a85d506d6eda70ae7cd6 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 25 Sep 2018 15:23:46 +0200 Subject: [PATCH] channels: Check return of ssh_buffer_unpack() Signed-off-by: Andreas Schneider --- src/channels.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/channels.c b/src/channels.c index 0e61e5cd..14da14d9 100644 --- a/src/channels.c +++ b/src/channels.c @@ -683,6 +683,10 @@ SSH_PACKET_CALLBACK(channel_rcv_request) { if (strcmp(request,"exit-status") == 0) { SAFE_FREE(request); rc = ssh_buffer_unpack(packet, "d", &channel->exit_status); + if (rc != SSH_OK) { + SSH_LOG(SSH_LOG_PACKET, "Invalid exit-status packet"); + return SSH_PACKET_USED; + } SSH_LOG(SSH_LOG_PACKET, "received exit-status %d", channel->exit_status); ssh_callbacks_execute_list(channel->callbacks,