]> granicus.if.org Git - vim/commitdiff
patch 9.0.1161: Coverity warns for using strcpy() v9.0.1161
authorBram Moolenaar <Bram@vim.org>
Mon, 9 Jan 2023 11:35:47 +0000 (11:35 +0000)
committerBram Moolenaar <Bram@vim.org>
Mon, 9 Jan 2023 11:35:47 +0000 (11:35 +0000)
Problem:    Coverity warns for using strcpy().
Solution:   Call a function to set the function name.

src/userfunc.c
src/version.c

index bdec34dedd015a09a6459e461d67a1d4b00c7b11..3ff49c9dd0fed46e402303843d284fd4d9582f1b 100644 (file)
@@ -2585,8 +2585,6 @@ copy_lambda_to_global_func(
            || ga_copy_strings(&ufunc->uf_lines, &fp->uf_lines) == FAIL)
        goto failed;
 
-    fp->uf_name_exp = ufunc->uf_name_exp == NULL ? NULL
-                                        : vim_strsave(ufunc->uf_name_exp);
     if (ufunc->uf_arg_types != NULL)
     {
        fp->uf_arg_types = ALLOC_MULT(type_T *, fp->uf_args.ga_len);
@@ -2604,7 +2602,10 @@ copy_lambda_to_global_func(
     fp->uf_ret_type = ufunc->uf_ret_type;
 
     fp->uf_refcount = 1;
-    STRCPY(fp->uf_name, global);
+
+    fp->uf_name_exp = NULL;
+    set_ufunc_name(fp, global);
+
     hash_add(&func_hashtab, UF2HIKEY(fp), "copy lambda");
 
     // the referenced dfunc_T is now used one more time
index 021f1b55b5a2c8c5fd39899e230af2344ae20daf..d53f809fab4dc225d9a7c761fc789637be36f424 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1161,
 /**/
     1160,
 /**/