Ai
1 Star 0 Fork 65

zhangxianting/vim

forked from src-openEuler/vim
关闭
 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-patch-9.1.0267-File-name-entered-in-GUI-dialog-is-ig.patch 1.78 KB
一键复制 编辑 原始数据 按行查看 历史
wjiang 提交于 2024-08-12 10:32 +08:00 . fix CVE-2024-41957 CVE-2024-41965
From c20bdf1107d48a1c14713709d12d429e761132af Mon Sep 17 00:00:00 2001
From: zeertzjq <zeertzjq@outlook.com>
Date: Fri, 5 Apr 2024 20:02:55 +0200
Subject: [PATCH] patch 9.1.0267: File name entered in GUI dialog is ignored
Problem: File name entered in GUI dialog is ignored (after v9.1.0265)
Solution: Only set file name to "Untitled" if GUI dialog didn't set it.
(zeertzjq)
closes: #14417
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
---
src/ex_cmds2.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index a75bfc11c..ce30b8d39 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -164,7 +164,6 @@ dialog_changed(
int ret;
buf_T *buf2;
exarg_T ea;
- int empty_buf = buf->b_fname == NULL ? TRUE : FALSE;
dialog_msg(buff, _("Save changes to \"%s\"?"), buf->b_fname);
if (checkall)
@@ -178,11 +177,14 @@ dialog_changed(
if (ret == VIM_YES)
{
+ int empty_bufname;
+
#ifdef FEAT_BROWSE
// May get file name, when there is none
browse_save_fname(buf);
#endif
- if (empty_buf)
+ empty_bufname = buf->b_fname == NULL ? TRUE : FALSE;
+ if (empty_bufname)
buf_set_name(buf->b_fnum, (char_u *)"Untitled");
if (check_overwrite(&ea, buf, buf->b_fname, buf->b_ffname, FALSE) == OK)
@@ -193,14 +195,11 @@ dialog_changed(
}
// restore to empty when write failed
- if (empty_buf)
+ if (empty_bufname)
{
- vim_free(buf->b_fname);
- buf->b_fname = NULL;
- vim_free(buf->b_ffname);
- buf->b_ffname = NULL;
- vim_free(buf->b_sfname);
- buf->b_sfname = NULL;
+ VIM_CLEAR(buf->b_fname);
+ VIM_CLEAR(buf->b_ffname);
+ VIM_CLEAR(buf->b_sfname);
unchanged(buf, TRUE, FALSE);
}
}
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhangxianting/vim.git
git@gitee.com:zhangxianting/vim.git
zhangxianting
vim
vim
master

搜索帮助