summaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
authorMilos Nikic <nikic.milos@gmail.com>2026-01-14 21:00:32 -0800
committerJake Koroman <jake@jakekoroman.com>2026-03-15 21:15:34 -0400
commit1db7ecac6613f5bcba76b24b5eef7ab560df573f (patch)
tree1e1358aa1c2875ac03d480e8c39f1fb7785cc1da /st.c
parent48c6df845a3de9470b939bbcdec71f6c09afd1fd (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);