Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
1589-ssh-avoid-crash-upon-exit-signal.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1589-ssh-avoid-crash-upon-exit-signal.patch of Package erlang
From 51000ea3a85cac863938db75c6032d846b2a79f2 Mon Sep 17 00:00:00 2001 From: Jakub Witczak <kuba@erlang.org> Date: Mon, 28 Oct 2024 08:57:02 +0100 Subject: [PATCH] ssh: avoid crash upon exit-signal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - avoid code crash when exit signal is received for closed channel Co-authored-by: Torbjörn Törnkvist <kruskakli@gmail.com> --- lib/ssh/src/ssh_connection.erl | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/lib/ssh/src/ssh_connection.erl b/lib/ssh/src/ssh_connection.erl index 34e97ba6ca..2645ba4214 100644 --- a/lib/ssh/src/ssh_connection.erl +++ b/lib/ssh/src/ssh_connection.erl @@ -739,21 +739,25 @@ handle_msg(#ssh_msg_channel_request{recipient_channel = ChannelId, handle_msg(#ssh_msg_channel_request{recipient_channel = ChannelId, request_type = "exit-signal", want_reply = false, - data = Data}, + data = Data}, #connection{channel_cache = Cache} = Connection0, _, _SSH) -> <<?DEC_BIN(SigName, _SigLen), - ?BOOLEAN(_Core), + ?BOOLEAN(_Core), ?DEC_BIN(Err, _ErrLen), ?DEC_BIN(Lang, _LangLen)>> = Data, - Channel = ssh_client_channel:cache_lookup(Cache, ChannelId), - RemoteId = Channel#channel.remote_id, - {Reply, Connection} = reply_msg(Channel, Connection0, - {exit_signal, ChannelId, - binary_to_list(SigName), - binary_to_list(Err), - binary_to_list(Lang)}), - CloseMsg = channel_close_msg(RemoteId), - {[{connection_reply, CloseMsg}|Reply], Connection}; + case ssh_client_channel:cache_lookup(Cache, ChannelId) of + #channel{remote_id = RemoteId} = Channel -> + {Reply, Connection} = reply_msg(Channel, Connection0, + {exit_signal, ChannelId, + binary_to_list(SigName), + binary_to_list(Err), + binary_to_list(Lang)}), + ChannelCloseMsg = channel_close_msg(RemoteId), + {[{connection_reply, ChannelCloseMsg}|Reply], Connection}; + _ -> + %% Channel already closed by peer + {[], Connection0} + end; handle_msg(#ssh_msg_channel_request{recipient_channel = ChannelId, request_type = "xon-xoff", -- 2.43.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor