mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 09:27:59 +00:00
Fix segfault if SSH connection terminates very early.
Introduced in the previous commit. The new ssh_ppl_final_output method shouldn't be called in any of the error cleanup functions if ssh->base_layer is NULL, which it can be if we haven't got far enough through the connection to set up any packet protocol layers at all. (For example, ECONNREFUSED would do it.)
This commit is contained in:
parent
d51b30ef49
commit
70aabdc67c
15
ssh/ssh.c
15
ssh/ssh.c
@ -474,7 +474,8 @@ void ssh_remote_error(Ssh *ssh, const char *fmt, ...)
|
||||
if (ssh->base_layer || !ssh->session_started) {
|
||||
GET_FORMATTED_MSG;
|
||||
|
||||
ssh_ppl_final_output(ssh->base_layer);
|
||||
if (ssh->base_layer)
|
||||
ssh_ppl_final_output(ssh->base_layer);
|
||||
|
||||
/* Error messages sent by the remote don't count as clean exits */
|
||||
ssh->exitcode = 128;
|
||||
@ -494,7 +495,8 @@ void ssh_remote_eof(Ssh *ssh, const char *fmt, ...)
|
||||
if (ssh->base_layer || !ssh->session_started) {
|
||||
GET_FORMATTED_MSG;
|
||||
|
||||
ssh_ppl_final_output(ssh->base_layer);
|
||||
if (ssh->base_layer)
|
||||
ssh_ppl_final_output(ssh->base_layer);
|
||||
|
||||
/* EOF from the remote, if we were expecting it, does count as
|
||||
* a clean exit */
|
||||
@ -519,7 +521,8 @@ void ssh_proto_error(Ssh *ssh, const char *fmt, ...)
|
||||
if (ssh->base_layer || !ssh->session_started) {
|
||||
GET_FORMATTED_MSG;
|
||||
|
||||
ssh_ppl_final_output(ssh->base_layer);
|
||||
if (ssh->base_layer)
|
||||
ssh_ppl_final_output(ssh->base_layer);
|
||||
|
||||
ssh->exitcode = 128;
|
||||
|
||||
@ -538,7 +541,8 @@ void ssh_sw_abort(Ssh *ssh, const char *fmt, ...)
|
||||
if (ssh->base_layer || !ssh->session_started) {
|
||||
GET_FORMATTED_MSG;
|
||||
|
||||
ssh_ppl_final_output(ssh->base_layer);
|
||||
if (ssh->base_layer)
|
||||
ssh_ppl_final_output(ssh->base_layer);
|
||||
|
||||
ssh->exitcode = 128;
|
||||
|
||||
@ -557,7 +561,8 @@ void ssh_user_close(Ssh *ssh, const char *fmt, ...)
|
||||
if (ssh->base_layer || !ssh->session_started) {
|
||||
GET_FORMATTED_MSG;
|
||||
|
||||
ssh_ppl_final_output(ssh->base_layer);
|
||||
if (ssh->base_layer)
|
||||
ssh_ppl_final_output(ssh->base_layer);
|
||||
|
||||
/* Closing the connection due to user action, even if the
|
||||
* action is the user aborting during authentication prompts,
|
||||
|
Loading…
Reference in New Issue
Block a user