mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 19:38:20 +00:00
Add eap->skip checks to script_host_{execute_file,do_range}
As a safety measure, return immediately from these functions if eap->skip is set. This is set when VimL is being parsed, to skip past dead code, and should not be executed.
This commit is contained in:
@@ -4232,6 +4232,7 @@ static void script_host_execute(char *name, exarg_T *eap)
|
|||||||
|
|
||||||
static void script_host_execute_file(char *name, exarg_T *eap)
|
static void script_host_execute_file(char *name, exarg_T *eap)
|
||||||
{
|
{
|
||||||
|
if (!eap->skip) {
|
||||||
uint8_t buffer[MAXPATHL];
|
uint8_t buffer[MAXPATHL];
|
||||||
vim_FullName((char *)eap->arg, (char *)buffer, sizeof(buffer), false);
|
vim_FullName((char *)eap->arg, (char *)buffer, sizeof(buffer), false);
|
||||||
|
|
||||||
@@ -4243,15 +4244,18 @@ static void script_host_execute_file(char *name, exarg_T *eap)
|
|||||||
tv_list_append_number(args, (int)eap->line2);
|
tv_list_append_number(args, (int)eap->line2);
|
||||||
(void)eval_call_provider(name, "execute_file", args, true);
|
(void)eval_call_provider(name, "execute_file", args, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void script_host_do_range(char *name, exarg_T *eap)
|
static void script_host_do_range(char *name, exarg_T *eap)
|
||||||
{
|
{
|
||||||
|
if (!eap->skip) {
|
||||||
list_T *args = tv_list_alloc(3);
|
list_T *args = tv_list_alloc(3);
|
||||||
tv_list_append_number(args, (int)eap->line1);
|
tv_list_append_number(args, (int)eap->line1);
|
||||||
tv_list_append_number(args, (int)eap->line2);
|
tv_list_append_number(args, (int)eap->line2);
|
||||||
tv_list_append_string(args, (const char *)eap->arg, -1);
|
tv_list_append_string(args, (const char *)eap->arg, -1);
|
||||||
(void)eval_call_provider(name, "do_range", args, true);
|
(void)eval_call_provider(name, "do_range", args, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// ":drop"
|
/// ":drop"
|
||||||
/// Opens the first argument in a window. When there are two or more arguments
|
/// Opens the first argument in a window. When there are two or more arguments
|
||||||
|
Reference in New Issue
Block a user