summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/screen-write.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2023-10-30 16:05:31 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2023-10-30 16:05:31 +0000
commitdd7f1022b7dcaac86e351450f11260d7b22b58a4 (patch)
tree4aa9d0b7866cf8270fd800d748759d21a3af7cda /usr.bin/tmux/screen-write.c
parent64748fb8c13c45baab3bbc29bf81cdb96d70cfa0 (diff)
Do not allow combined UTF-8 characters that are too long, GitHub issue
3729.
Diffstat (limited to 'usr.bin/tmux/screen-write.c')
-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 45b36c8f3a1..71b7f99cadf 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.223 2023/10/23 08:12:00 nicm Exp $ */
+/* $OpenBSD: screen-write.c,v 1.224 2023/10/30 16:05:30 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -2025,6 +2025,10 @@ screen_write_combine(struct screen_write_ctx *ctx, const struct grid_cell *gc)
return (0);
}
+ /* Check if this combined character would be too long. */
+ if (last.data.size + ud->size > sizeof last.data.data)
+ return (0);
+
/* Combining; flush any pending output. */
screen_write_collect_flush(ctx, 0, __func__);