Skip to content

Commit

Permalink
patch 9.0.1161: Coverity warns for using strcpy()
Browse files Browse the repository at this point in the history
Problem:    Coverity warns for using strcpy().
Solution:   Call a function to set the function name.
  • Loading branch information
brammool committed Jan 9, 2023
1 parent e01e521 commit c8ab30a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/userfunc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1161,
/**/
1160,
/**/
Expand Down

0 comments on commit c8ab30a

Please sign in to comment.