0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 9.0.1440: "rvim" can execute a shell through :diffpatch

Problem:    "rvim" can execute a shell through :diffpatch.
Solution:   Disallow the shell "patch" command.
This commit is contained in:
Bram Moolenaar
2023-04-04 22:04:53 +01:00
parent cde8de0345
commit 23a971da50
3 changed files with 22 additions and 1 deletions

View File

@@ -1310,6 +1310,9 @@ ex_diffpatch(exarg_T *eap)
else
#endif
{
if (check_restricted())
goto theend;
// Build the patch command and execute it. Ignore errors. Switch to
// cooked mode to allow the user to respond to prompts.
vim_snprintf((char *)buf, buflen, "patch -o %s %s < %s",
@@ -1380,7 +1383,8 @@ ex_diffpatch(exarg_T *eap)
// Do filetype detection with the new name.
if (au_has_group((char_u *)"filetypedetect"))
do_cmdline_cmd((char_u *)":doau filetypedetect BufRead");
do_cmdline_cmd(
(char_u *)":doau filetypedetect BufRead");
}
}
}