changeset 26692:de714c98c9b8 v8.2.3875

patch 8.2.3875: gcc complains about buffer overrun Commit: https://github.com/vim/vim/commit/b4168fd917e869912e0649fe13c10e5e6a595199 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Dec 22 20:29:09 2021 +0000 patch 8.2.3875: gcc complains about buffer overrun Problem: gcc complains about buffer overrun. Solution: Use mch_memmove() instead of STRCPY(). (John Marriott)
author Bram Moolenaar <Bram@vim.org>
date Wed, 22 Dec 2021 21:30:04 +0100
parents 87c4291e1f0d
children 312866076d85
files src/dict.c src/version.c
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/dict.c
+++ b/src/dict.c
@@ -222,11 +222,12 @@ dict_free_items(int copyID)
 dictitem_alloc(char_u *key)
 {
     dictitem_T *di;
+    size_t len = STRLEN(key);
 
-    di = alloc(offsetof(dictitem_T, di_key) + STRLEN(key) + 1);
+    di = alloc(offsetof(dictitem_T, di_key) + len + 1);
     if (di != NULL)
     {
-	STRCPY(di->di_key, key);
+	mch_memmove(di->di_key, key, len + 1);
 	di->di_flags = DI_FLAGS_ALLOC;
 	di->di_tv.v_lock = 0;
 	di->di_tv.v_type = VAR_UNKNOWN;
--- a/src/version.c
+++ b/src/version.c
@@ -750,6 +750,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    3875,
+/**/
     3874,
 /**/
     3873,