diff src/userfunc.c @ 34567:7de5ae6a0518 v9.1.0182

patch 9.1.0182: Can define function with invalid name inside 'formatexpr' Commit: https://github.com/vim/vim/commit/6a04bf5ee523b2d6d01d7290e356a30de219f465 Author: zeertzjq <zeertzjq@outlook.com> Date: Sat Mar 16 09:39:06 2024 +0100 patch 9.1.0182: Can define function with invalid name inside 'formatexpr' Problem: Can define function with invalid name inside 'formatexpr'. Solution: Use goto instead of checking for did_emsg later. (zeertzjq) closes: #14209 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Sat, 16 Mar 2024 09:45:04 +0100
parents 5c1a025192ed
children d4fb6ea26ae4
line wrap: on
line diff
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -4977,7 +4977,10 @@ define_function(
 					: eval_isnamec(name_base[i])); ++i)
 		;
 	    if (name_base[i] != NUL)
+	    {
 		emsg_funcname(e_invalid_argument_str, arg);
+		goto ret_free;
+	    }
 
 	    // In Vim9 script a function cannot have the same name as a
 	    // variable.