commit 8cf38c2fd9408f7de9d9ff1e4db6fc90aba554cf
parent 1b95eaf84bdc5189b435fe98b365b5f120d99c2d
Author: zeertzjq <zeertzjq@outlook.com>
Date: Thu, 17 Nov 2022 18:21:53 +0800
vim-patch:8.2.2026: Coverity warns for possibly using not NUL terminated string
Problem: Coverity warns for possibly using not NUL terminated string.
Solution: Put a NUL in b0_hname just in case.
https://github.com/vim/vim/commit/e79cdb69a4905ccf766494265d4c6f8701d10c39
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat:
1 file changed, 1 insertion(+), 0 deletions(-)
diff --git a/src/nvim/memline.c b/src/nvim/memline.c
@@ -1548,6 +1548,7 @@ static bool swapfile_unchanged(char *fname)
char hostname[B0_HNAME_SIZE];
os_get_hostname(hostname, B0_HNAME_SIZE);
hostname[B0_HNAME_SIZE - 1] = NUL;
+ b0.b0_hname[B0_HNAME_SIZE - 1] = NUL; // in case of corruption
if (STRICMP(b0.b0_hname, hostname) != 0) {
ret = false;
}