diff src/memline.c @ 22959:4cce4a5d3fd3 v8.2.2026

patch 8.2.2026: Coverity warns for possibly using not NUL terminated string Commit: https://github.com/vim/vim/commit/e79cdb69a4905ccf766494265d4c6f8701d10c39 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Nov 21 13:51:16 2020 +0100 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.
author Bram Moolenaar <Bram@vim.org>
date Sat, 21 Nov 2020 14:00:03 +0100
parents 83c2c489cb1b
children b545334ae654
line wrap: on
line diff
--- a/src/memline.c
+++ b/src/memline.c
@@ -2252,6 +2252,7 @@ swapfile_unchanged(char_u *fname)
 
 	mch_get_host_name(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;
     }