diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2017-09-19 04:24:23 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2017-09-19 04:24:23 +0000 |
commit | 133b0a5e2fd8cb8a83ec593b59b1df63dc8c9a95 (patch) | |
tree | f8f1077fa403863a8c6ffded23e7e87242ddb467 /usr.bin | |
parent | b321962a6d373e4894b24c09022819d82c64657d (diff) |
fix use-after-free in ~^Z escape handler path, introduced in channels.c
refactor; spotted by millert@ "makes sense" deraadt@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ssh/clientloop.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/usr.bin/ssh/clientloop.c b/usr.bin/ssh/clientloop.c index 0c7741bb5f6..c439b03cd7d 100644 --- a/usr.bin/ssh/clientloop.c +++ b/usr.bin/ssh/clientloop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clientloop.c,v 1.304 2017/09/12 06:35:32 djm Exp $ */ +/* $OpenBSD: clientloop.c,v 1.305 2017/09/19 04:24:22 djm Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -592,13 +592,9 @@ client_suspend_self(Buffer *bin, Buffer *bout, Buffer *berr) leave_raw_mode(options.request_tty == REQUEST_TTY_FORCE); - /* - * Free (and clear) the buffer to reduce the amount of data that gets - * written to swap. - */ - buffer_free(bin); - buffer_free(bout); - buffer_free(berr); + sshbuf_reset(bin); + sshbuf_reset(bout); + sshbuf_reset(berr); /* Send the suspend signal to the program itself. */ kill(getpid(), SIGTSTP); @@ -606,11 +602,6 @@ client_suspend_self(Buffer *bin, Buffer *bout, Buffer *berr) /* Reset window sizes in case they have changed */ received_window_change_signal = 1; - /* OK, we have been continued by the user. Reinitialize buffers. */ - buffer_init(bin); - buffer_init(bout); - buffer_init(berr); - enter_raw_mode(options.request_tty == REQUEST_TTY_FORCE); } |