vim/backport-CVE-2022-2207.patch

30 lines
828 B
Diff
Raw Normal View History

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