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
This commit is contained in:
Jan Edmund Lazo
2021-05-19 21:06:49 -04:00
parent 003cda2312
commit 49ab1b91e7
4 changed files with 16 additions and 14 deletions

View File

@@ -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);