summaryrefslogtreecommitdiffstats
path: root/screen-write.c
diff options
context:
space:
mode:
authornicm <nicm>2023-10-30 16:05:30 +0000
committernicm <nicm>2023-10-30 16:05:30 +0000
commitfdf465925e9b3cdd90c15a2f7fb475397f51b993 (patch)
tree3d5d75ce6cf55c5d05181885cde16471a4c91afb /screen-write.c
parent36e1ac65560a34c6fa381f821f6b1b733f9b6ed6 (diff)
Do not allow combined UTF-8 characters that are too long, GitHub issue
3729.
Diffstat (limited to 'screen-write.c')
-rw-r--r--screen-write.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/screen-write.c b/screen-write.c
index 01632f61..ff758a17 100644
--- a/screen-write.c
+++ b/screen-write.c
@@ -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__);