0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.2666: Vim9: not enough function arguments checked for string

Problem:    Vim9: not enough function arguments checked for string.
Solution:   Check in ch_logfile(), char2nr() and others.
This commit is contained in:
Bram Moolenaar
2021-03-27 21:23:30 +01:00
parent 7b45d46cf7
commit c580943965
6 changed files with 54 additions and 0 deletions

View File

@@ -2521,6 +2521,8 @@ f_changenr(typval_T *argvars UNUSED, typval_T *rettv)
static void
f_char2nr(typval_T *argvars, typval_T *rettv)
{
if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
return;
if (has_mbyte)
{
int utf8 = 0;
@@ -2685,11 +2687,16 @@ f_confirm(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
char_u *typestr;
int error = FALSE;
if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
return;
message = tv_get_string_chk(&argvars[0]);
if (message == NULL)
error = TRUE;
if (argvars[1].v_type != VAR_UNKNOWN)
{
if (in_vim9script() && check_for_string_arg(argvars, 1) == FAIL)
return;
buttons = tv_get_string_buf_chk(&argvars[1], buf);
if (buttons == NULL)
error = TRUE;
@@ -2698,6 +2705,8 @@ f_confirm(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
def = (int)tv_get_number_chk(&argvars[2], &error);
if (argvars[3].v_type != VAR_UNKNOWN)
{
if (in_vim9script() && check_for_string_arg(argvars, 3) == FAIL)
return;
typestr = tv_get_string_buf_chk(&argvars[3], buf2);
if (typestr == NULL)
error = TRUE;