4 Star 1 Fork 4

OpenCloudOS Stream/vim

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0005-backport-CVE-2023-48235-patch-9.0.2110-security-over.patch 1.59 KB
一键复制 编辑 原始数据 按行查看 历史
nilusyi 提交于 2024-02-20 14:15 . fix some CVEs
From 39b29bf6c5589bb2dc7d2c4c0a24a851fb67113e Mon Sep 17 00:00:00 2001
From: Christian Brabandt <[email protected]>
Date: Tue, 14 Nov 2023 21:33:29 +0100
Subject: [PATCH 5/9] backport-CVE-2023-48235: patch 9.0.2110: [security]:
overflow in ex address parsing
Problem: [security]: overflow in ex address parsing
Solution: Verify that lnum is positive, before substracting from
LONG_MAX
[security]: overflow in ex address parsing
When parsing relative ex addresses one may unintentionally cause an
overflow (because LONG_MAX - lnum will overflow for negative addresses).
So verify that lnum is actually positive before doing the overflow
check.
Signed-off-by: Christian Brabandt <[email protected]>
Signed-off-by: Yi Lin <[email protected]>
---
src/ex_docmd.c | 2 +-
src/testdir/test_excmd.vim | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 06837ac92..01d411a63 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -4644,7 +4644,7 @@ get_address(
lnum -= n;
else
{
- if (n >= LONG_MAX - lnum)
+ if (lnum >= 0 && n >= LONG_MAX - lnum)
{
emsg(_(e_line_number_out_of_range));
goto error;
diff --git a/src/testdir/test_excmd.vim b/src/testdir/test_excmd.vim
index 3637351f6..47fc26726 100644
--- a/src/testdir/test_excmd.vim
+++ b/src/testdir/test_excmd.vim
@@ -724,5 +724,9 @@ func Test_write_after_rename()
bwipe!
endfunc
+" catch address lines overflow
+func Test_ex_address_range_overflow()
+ call assert_fails(':--+foobar', 'E492:')
+endfunc
" vim: shiftwidth=2 sts=2 expandtab
--
2.41.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/opencloudos-stream/vim.git
[email protected]:opencloudos-stream/vim.git
opencloudos-stream
vim
vim
master

搜索帮助