summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2021-01-27 10:42:52 +0000
committernicm <nicm@openbsd.org>2021-01-27 10:42:52 +0000
commit50fcbc36ffb9de38d3c52e7e41daef2194488f6f (patch)
tree26b9dfda176bc4b3176ef20820b1d9cbf8ccd13c
parentthis needs kex.h now (diff)
downloadwireguard-openbsd-50fcbc36ffb9de38d3c52e7e41daef2194488f6f.tar.xz
wireguard-openbsd-50fcbc36ffb9de38d3c52e7e41daef2194488f6f.zip
Flush pending output before entering or exiting alternate screen rather
than leaking it, oss-fuzz issue 29959.
-rw-r--r--usr.bin/tmux/screen-write.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/tmux/screen-write.c b/usr.bin/tmux/screen-write.c
index 917fbaeb3e5..d9a5bf8242a 100644
--- a/usr.bin/tmux/screen-write.c
+++ b/usr.bin/tmux/screen-write.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: screen-write.c,v 1.191 2021/01/22 11:28:33 nicm Exp $ */
+/* $OpenBSD: screen-write.c,v 1.192 2021/01/27 10:42:52 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1970,6 +1970,8 @@ screen_write_alternateon(struct screen_write_ctx *ctx, struct grid_cell *gc,
if (wp != NULL && !options_get_number(wp->options, "alternate-screen"))
return;
+
+ screen_write_collect_flush(ctx, 0, __func__);
screen_alternate_on(ctx->s, gc, cursor);
screen_write_initctx(ctx, &ttyctx, 1);
@@ -1986,6 +1988,8 @@ screen_write_alternateoff(struct screen_write_ctx *ctx, struct grid_cell *gc,
if (wp != NULL && !options_get_number(wp->options, "alternate-screen"))
return;
+
+ screen_write_collect_flush(ctx, 0, __func__);
screen_alternate_off(ctx->s, gc, cursor);
screen_write_initctx(ctx, &ttyctx, 1);