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

patch 8.2.3902: Vim9: double free with nested :def function

Problem:    Vim9: double free with nested :def function.
Solution:   Pass "line_to_free" from compile_def_function() and make sure
            cmdlinep is valid.
This commit is contained in:
Bram Moolenaar
2021-12-26 14:23:22 +00:00
parent 71eb3ad579
commit 9c23f9bb5f
6 changed files with 62 additions and 26 deletions

View File

@@ -3345,10 +3345,12 @@ exec_instructions(ectx_T *ectx)
else
{
exarg_T ea;
char_u *line_to_free = NULL;
CLEAR_FIELD(ea);
ea.cmd = ea.arg = iptr->isn_arg.string;
define_function(&ea, NULL);
define_function(&ea, NULL, &line_to_free);
vim_free(line_to_free);
}
break;