comparison src/userfunc.c @ 23829:950875545045 v8.2.2456

patch 8.2.2456: Coverity warning for strcpy() into fixed size array Commit: https://github.com/vim/vim/commit/7b6903f02c9eeb12cd85941ea0d352d84e4dab30 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Feb 3 19:31:29 2021 +0100 patch 8.2.2456: Coverity warning for strcpy() into fixed size array Problem: Coverity warning for strcpy() into fixed size array. Solution: Add a type cast to hopefully silence the bogus warning.
author Bram Moolenaar <Bram@vim.org>
date Wed, 03 Feb 2021 19:45:04 +0100
parents baf9069f64ca
children 85cf06ddb2a8
comparison
equal deleted inserted replaced
23828:628f15e44a31 23829:950875545045
401 } 401 }
402 402
403 static void 403 static void
404 set_ufunc_name(ufunc_T *fp, char_u *name) 404 set_ufunc_name(ufunc_T *fp, char_u *name)
405 { 405 {
406 STRCPY(fp->uf_name, name); 406 // Add a type cast to avoid a warning for an overflow, the uf_name[] array
407 // actually extends beyond the struct.
408 STRCPY((void *)fp->uf_name, name);
407 409
408 if (name[0] == K_SPECIAL) 410 if (name[0] == K_SPECIAL)
409 { 411 {
410 fp->uf_name_exp = alloc(STRLEN(name) + 3); 412 fp->uf_name_exp = alloc(STRLEN(name) + 3);
411 if (fp->uf_name_exp != NULL) 413 if (fp->uf_name_exp != NULL)