1 Star 0 Fork 58

寓述/vim

forked from openMajun/vim 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-CVE-2022-0213.patch 1.57 KB
一键复制 编辑 原始数据 按行查看 历史
guozhaorui 提交于 2022-01-29 11:50 +08:00 . fix CVE-2022-0213 CVE-2022-0261 CVE-2022-0318
From de05bb25733c3319e18dca44e9b59c6ee389eb26 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Thu, 13 Jan 2022 13:08:14 +0000
Subject: [PATCH] patch 8.2.4074: going over the end of NameBuff
Problem: Going over the end of NameBuff.
Solution: Check length when appending a space.
---
src/drawscreen.c | 9 +++++----
src/testdir/test_edit.vim | 15 +++++++++++++++
src/version.c | 2 ++
3 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/src/drawscreen.c b/src/drawscreen.c
index 9acb705..7425ad4 100644
--- a/src/drawscreen.c
+++ b/src/drawscreen.c
@@ -437,12 +437,13 @@ win_redr_status(win_T *wp, int ignore_pum UNUSED)
p = NameBuff;
len = (int)STRLEN(p);
- if (bt_help(wp->w_buffer)
+ if ((bt_help(wp->w_buffer)
#ifdef FEAT_QUICKFIX
- || wp->w_p_pvw
+ || wp->w_p_pvw
#endif
- || bufIsChanged(wp->w_buffer)
- || wp->w_buffer->b_p_ro)
+ || bufIsChanged(wp->w_buffer)
+ || wp->w_buffer->b_p_ro)
+ && len < MAXPATHL - 1)
*(p + len++) = ' ';
if (bt_help(wp->w_buffer))
{
diff --git a/src/testdir/test_edit.vim b/src/testdir/test_edit.vim
index c3b1af5..48e6ff2 100644
--- a/src/testdir/test_edit.vim
+++ b/src/testdir/test_edit.vim
@@ -1532,3 +1532,18 @@ func Test_edit_put_CTRL_E()
set encoding=utf-8
endfunc
+" Weird long file name was going over the end of NameBuff
+func Test_edit_overlong_file_name()
+ CheckUnix
+
+ file 0000000000000000000000000000
+ file %%%%%%%%%%%%%%%%%%%%%%%%%%
+ file %%%%%%
+ set readonly
+ set ls=2
+
+ redraw!
+ set noreadonly ls&
+ bwipe!
+endfunc
+
--
2.23.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wqh0122/vim.git
git@gitee.com:wqh0122/vim.git
wqh0122
vim
vim
master

搜索帮助