mirror of
https://github.com/neovim/neovim.git
synced 2025-09-14 23:38:17 +00:00
refactor: strlcat instead of str{n}cat.
Add xstrlcat function. Closes #3042 References #988 References #1069 coverity: 71530, 71531, 71532
This commit is contained in:

committed by
Justin M. Keyes

parent
d4b931deac
commit
6e75bb5cbb
@@ -398,8 +398,12 @@ char *concat_fnames_realloc(char *fname1, const char *fname2, bool sep)
|
||||
void add_pathsep(char *p)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
if (*p != NUL && !after_pathsep(p, p + strlen(p)))
|
||||
strcat(p, PATHSEPSTR);
|
||||
const size_t len = strlen(p);
|
||||
const size_t pathsep_len = sizeof(PATHSEPSTR);
|
||||
assert(len < MAXPATHL - pathsep_len);
|
||||
if (*p != NUL && !after_pathsep(p, p + len)) {
|
||||
memcpy(p + len, PATHSEPSTR, pathsep_len);
|
||||
}
|
||||
}
|
||||
|
||||
/// Get an allocated copy of the full path to a file.
|
||||
|
Reference in New Issue
Block a user