vim/backport-CVE-2022-2206.patch
shixuantong b30deda29f fix CVE-2022-2125,CVE-2022-2206
(cherry picked from commit c5521ca91dc920b634ca8e780a02627fd5f31520)
2022-07-05 14:46:17 +08:00

33 lines
868 B
Diff

From e178af5a586ea023622d460779fdcabbbfac0908 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Sat, 25 Jun 2022 19:54:09 +0100
Subject: [PATCH] patch 8.2.5160: accessing invalid memory after changing
terminal size
Problem: Accessing invalid memory after changing terminal size.
Solution: Adjust cmdline_row and msg_row to the value of Rows.
---
src/term.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/term.c b/src/term.c
index 77cfa7d..307e3bf 100644
--- a/src/term.c
+++ b/src/term.c
@@ -3223,6 +3223,12 @@ check_shellsize(void)
if (Rows < min_rows()) // need room for one window and command line
Rows = min_rows();
limit_screen_size();
+
+ // make sure these values are not invalid
+ if (cmdline_row >= Rows)
+ cmdline_row = Rows - 1;
+ if (msg_row >= Rows)
+ msg_row = Rows - 1;
}
/*
--
1.8.3.1