]> granicus.if.org Git - vim/commitdiff
patch 8.2.2456: Coverity warning for strcpy() into fixed size array v8.2.2456
authorBram Moolenaar <Bram@vim.org>
Wed, 3 Feb 2021 18:31:29 +0000 (19:31 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 3 Feb 2021 18:31:29 +0000 (19:31 +0100)
Problem:    Coverity warning for strcpy() into fixed size array.
Solution:   Add a type cast to hopefully silence the bogus warning.

src/userfunc.c
src/version.c

index 701edaf30ddb2de626c416efaef8ed2b14f1ea3d..bdf4064263abe3f2aafb37f488284686562c5ca3 100644 (file)
@@ -403,7 +403,9 @@ register_closure(ufunc_T *fp)
     static void
 set_ufunc_name(ufunc_T *fp, char_u *name)
 {
-    STRCPY(fp->uf_name, name);
+    // Add a type cast to avoid a warning for an overflow, the uf_name[] array
+    // actually extends beyond the struct.
+    STRCPY((void *)fp->uf_name, name);
 
     if (name[0] == K_SPECIAL)
     {
index 19a2f8296a29d3b15213595f3be62086ab705fe1..804899f0644c27a846dcab38132504885ab8e51f 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2456,
 /**/
     2455,
 /**/