diff src/evalfunc.c @ 24250:01b274c3f69b v8.2.2666

patch 8.2.2666: Vim9: not enough function arguments checked for string Commit: https://github.com/vim/vim/commit/c580943965fc9b006ec233bdee4ea5380f5594ea Author: Bram Moolenaar <Bram@vim.org> Date: Sat Mar 27 21:23:30 2021 +0100 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.
author Bram Moolenaar <Bram@vim.org>
date Sat, 27 Mar 2021 21:30:02 +0100
parents 35603c7991d7
children 55f458d35292
line wrap: on
line diff
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -2521,6 +2521,8 @@ f_changenr(typval_T *argvars UNUSED, typ
     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, typv
     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, typv
 	    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;