diff options
| author | Milos Nikic <nikic.milos@gmail.com> | 2026-01-14 21:00:32 -0800 |
|---|---|---|
| committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2026-01-16 14:12:07 +0100 |
| commit | 688f70add0d1da8a416bf7df763328d694a24a3a (patch) | |
| tree | dff22bfe5370b282d60bdd3523812a48da99c500 | |
| parent | Disable bracked paste in reset (diff) | |
| download | st-688f70add0d1da8a416bf7df763328d694a24a3a.tar.gz st-688f70add0d1da8a416bf7df763328d694a24a3a.zip | |
st: guard tsetdirt() against zero-sized terminal
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.
| -rw-r--r-- | st.c | 3 |
1 files changed, 3 insertions, 0 deletions
| @@ -965,6 +965,9 @@ tsetdirt(int top, int bot) | |||
| 965 | { | 965 | { |
| 966 | int i; | 966 | int i; |
| 967 | 967 | ||
| 968 | if (term.row <= 0) | ||
| 969 | return; | ||
| 970 | |||
| 968 | LIMIT(top, 0, term.row-1); | 971 | LIMIT(top, 0, term.row-1); |
| 969 | LIMIT(bot, 0, term.row-1); | 972 | LIMIT(bot, 0, term.row-1); |
| 970 | 973 | ||
