vim/backport-CVE-2022-2124.patch
lauk001 f89a7b0003 fix CVE-2022-2124
(cherry picked from commit bea0a2d544dd392ecc3f8277c711435f54ae7f74)
2022-06-30 15:13:10 +08:00

36 lines
846 B
Diff

From e4463991b2c9243ae93462118b6d6f648852bb0c Mon Sep 17 00:00:00 2001
From: lauk001 <liukuo@kylinos.cn>
Date: Tue, 21 Jun 2022 13:43:57 +0800
Subject: [PATCH] CVE-2022-2124
Signed-off-by: lauk001 <liukuo@kylinos.cn>
---
src/search.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/search.c b/src/search.c
index 75f0c59..87acb33 100644
--- a/src/search.c
+++ b/src/search.c
@@ -4589,11 +4589,17 @@ current_quote(
// Find out if we have a quote in the selection.
while (i <= col_end)
+ {
+ // check for going over the end of the line, which can happen if
+ // the line was changed after the Visual area was selected.
+ if (line[i] == NUL)
+ break;
if (line[i++] == quotechar)
{
selected_quote = TRUE;
break;
}
+ }
}
if (!vis_empty && line[col_start] == quotechar)
--
2.33.0