aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
authorMilos Nikic <[email protected]>2026-01-14 21:00:32 -0800
committerHiltjo Posthuma <[email protected]>2026-01-16 14:12:07 +0100
commit688f70add0d1da8a416bf7df763328d694a24a3a (patch)
treedff22bfe5370b282d60bdd3523812a48da99c500 /st.c
parent0723b7e39e73b2bcfce047b047f6e795d6184028 (diff)
st: guard tsetdirt() against zero-sized terminalHEADmaster
tsetdirt() assumes term.row > 0. During early init or resize paths this may not hold, leading to out-of-bounds access. Bail out early if there are no rows.
Diffstat (limited to 'st.c')
-rw-r--r--st.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/st.c b/st.c
index e55e7b3..6f40e35 100644
--- a/st.c
+++ b/st.c
@@ -965,6 +965,9 @@ tsetdirt(int top, int bot)
{
int i;
+ if (term.row <= 0)
+ return;
+
LIMIT(top, 0, term.row-1);
LIMIT(bot, 0, term.row-1);