From 49ab1b91e7cccb4fc5edad6d2fa8c547fb38942b Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Wed, 19 May 2021 21:06:49 -0400 Subject: Remove '- 1' for sizes passed to xstrlcpy xstrlcpy() NUL-terminates the destination string such that reducing the destination string length by 1 to reserve the last byte for NUL is pointless. https://github.com/neovim/neovim/pull/14490#discussion_r635661185 --- src/nvim/path.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/path.c') diff --git a/src/nvim/path.c b/src/nvim/path.c index 3e1713fbdd..fe50be5ea1 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -65,7 +65,7 @@ FileComparison path_full_compare(char_u *const s1, char_u *const s2, if (expandenv) { expand_env(s1, exp1, MAXPATHL); } else { - xstrlcpy((char *)exp1, (const char *)s1, MAXPATHL - 1); + xstrlcpy((char *)exp1, (const char *)s1, MAXPATHL); } bool id_ok_1 = os_fileid((char *)exp1, &file_id_1); bool id_ok_2 = os_fileid((char *)s2, &file_id_2); -- cgit