1 Star 0 Fork 58

YukariChiba/vim

forked from src-openEuler/vim 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-CVE-2022-1733.patch 1.21 KB
一键复制 编辑 原始数据 按行查看 历史
桐小哥 提交于 2022-05-31 09:24 +08:00 . fix CVE-2022-1733 CVE-2022-1735
From 60ae0e71490c97f2871a6344aca61cacf220f813 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Mon, 16 May 2022 18:06:15 +0100
Subject: [PATCH] patch 8.2.4968: reading past end of the line when C-indenting
Problem: Reading past end of the line when C-indenting.
Solution: Check for NUL.
---
src/cindent.c | 2 +-
src/testdir/test_cindent.vim | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/cindent.c b/src/cindent.c
index 28d1558..1b2763f 100644
--- a/src/cindent.c
+++ b/src/cindent.c
@@ -91,7 +91,7 @@ skip_string(char_u *p)
while (vim_isdigit(p[i - 1])) // '\000'
++i;
}
- if (p[i] == '\'') // check for trailing '
+ if (p[i - 1] != NUL && p[i] == '\'') // check for trailing '
{
p += i;
continue;
diff --git a/src/testdir/test_cindent.vim b/src/testdir/test_cindent.vim
index 2a87460..3b2200a 100644
--- a/src/testdir/test_cindent.vim
+++ b/src/testdir/test_cindent.vim
@@ -5263,4 +5263,11 @@ func Test_find_brace_backwards()
endfunc
+" This was reading past the end of the line
+func Test_cindent_check_funcdecl()
+ new
+ sil norm o0('\0=L
+ bwipe!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
--
1.8.3.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/YukariChiba/vim.git
git@gitee.com:YukariChiba/vim.git
YukariChiba
vim
vim
master

搜索帮助