summaryrefslogtreecommitdiff
path: root/clientloop.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2017-09-19 04:24:22 +0000
committerDamien Miller <djm@mindrot.org>2017-09-19 14:26:43 +1000
commit5b8da1f53854c0923ec6e927e86709e4d72737b6 (patch)
treead137d283c7114e5672426ee46bb813199168a65 /clientloop.c
parenta3839d8d2b89ff1a80cadd4dd654336710de2c9e (diff)
upstream commit
fix use-after-free in ~^Z escape handler path, introduced in channels.c refactor; spotted by millert@ "makes sense" deraadt@ Upstream-ID: 8fa2cdc65c23ad6420c1e59444b0c955b0589b22
Diffstat (limited to 'clientloop.c')
-rw-r--r--clientloop.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/clientloop.c b/clientloop.c
index 3b4840b12..791d336e3 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: clientloop.c,v 1.304 2017/09/12 06:35:32 djm Exp $ */ 1/* $OpenBSD: clientloop.c,v 1.305 2017/09/19 04:24:22 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -600,13 +600,9 @@ client_suspend_self(Buffer *bin, Buffer *bout, Buffer *berr)
600 600
601 leave_raw_mode(options.request_tty == REQUEST_TTY_FORCE); 601 leave_raw_mode(options.request_tty == REQUEST_TTY_FORCE);
602 602
603 /* 603 sshbuf_reset(bin);
604 * Free (and clear) the buffer to reduce the amount of data that gets 604 sshbuf_reset(bout);
605 * written to swap. 605 sshbuf_reset(berr);
606 */
607 buffer_free(bin);
608 buffer_free(bout);
609 buffer_free(berr);
610 606
611 /* Send the suspend signal to the program itself. */ 607 /* Send the suspend signal to the program itself. */
612 kill(getpid(), SIGTSTP); 608 kill(getpid(), SIGTSTP);
@@ -614,11 +610,6 @@ client_suspend_self(Buffer *bin, Buffer *bout, Buffer *berr)
614 /* Reset window sizes in case they have changed */ 610 /* Reset window sizes in case they have changed */
615 received_window_change_signal = 1; 611 received_window_change_signal = 1;
616 612
617 /* OK, we have been continued by the user. Reinitialize buffers. */
618 buffer_init(bin);
619 buffer_init(bout);
620 buffer_init(berr);
621
622 enter_raw_mode(options.request_tty == REQUEST_TTY_FORCE); 613 enter_raw_mode(options.request_tty == REQUEST_TTY_FORCE);
623} 614}
624 615