From 8cf38c2fd9408f7de9d9ff1e4db6fc90aba554cf Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 17 Nov 2022 18:21:53 +0800 Subject: 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 --- src/nvim/memline.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/nvim/memline.c b/src/nvim/memline.c index 8b5aef3be1..02a7e1f697 100644 --- 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; } -- cgit