vim/backport-CVE-2022-2207.patch
weiwei_tiantian 4236deafb4 fix CVE-2022-2207 CVE-2022-2208
(cherry picked from commit c373d168c4ec97868e1eb2871b8e98d27ea109ba)
2022-07-11 09:44:07 +08:00

30 lines
828 B
Diff

From 0971c7a4e537ea120a6bb2195960be8d0815e97b Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Sun, 26 Jun 2022 12:59:02 +0100
Subject: [PATCH] patch 8.2.5162: reading before the start of the line with BS
in Replace mode
Problem: Reading before the start of the line with BS in Replace mode.
Solution: Check the cursor column is more than zero.
---
src/edit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/edit.c b/src/edit.c
index c4ede2b..bc0b7dc 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -4761,7 +4761,7 @@ ins_bs(
#endif
// delete characters until we are at or before want_vcol
- while (vcol > want_vcol
+ while (vcol > want_vcol && curwin->w_cursor.col > 0
&& (cc = *(ml_get_cursor() - 1), VIM_ISWHITE(cc)))
ins_bs_one(&vcol);
--
2.27.0