diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-10-02 18:11:56 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-10-02 18:11:56 +0200 |
commit | 3f974ff45e0ea4b85fea7d8768f005d8a2c7941e (patch) | |
tree | 81bbcfa7014b80e712210e797ac43df8aa418010 | |
parent | fa79be6b10e1d34fd697a56e85f6c0ce101f3d62 (diff) | |
download | vim-git-3f974ff45e0ea4b85fea7d8768f005d8a2c7941e.tar.gz |
patch 8.2.1785: compiler warning for strcp() out of boundsv8.2.1785
Problem: Compiler warning for strcp() out of bounds. (Christian Brabandt)
Solution: use memmove() instead.
-rw-r--r-- | src/dict.c | 5 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/dict.c b/src/dict.c index 05281cb70..5725140df 100644 --- a/src/dict.c +++ b/src/dict.c @@ -236,11 +236,12 @@ dictitem_alloc(char_u *key) dictitem_copy(dictitem_T *org) { dictitem_T *di; + size_t len = STRLEN(org->di_key); - di = alloc(offsetof(dictitem_T, di_key) + STRLEN(org->di_key) + 1); + di = alloc(offsetof(dictitem_T, di_key) + len + 1); if (di != NULL) { - STRCPY(di->di_key, org->di_key); + mch_memmove(di->di_key, org->di_key, len + 1); di->di_flags = DI_FLAGS_ALLOC; copy_tv(&org->di_tv, &di->di_tv); } diff --git a/src/version.c b/src/version.c index 31e835902..8f0fac9b8 100644 --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1785, +/**/ 1784, /**/ 1783, |