Avoided using a truncate strncpy() in the fuse library

Replace strncpy() by memcpy() when the exact size if known, thus
silencing the compiler warnings.
This commit is contained in:
Jean-Pierre André 2020-03-07 11:56:46 +01:00
parent 688578c1a6
commit ef61c82529
2 changed files with 2 additions and 2 deletions

View File

@ -463,7 +463,7 @@ static char *add_name(char *buf, char *s, const char *name)
return NULL;
}
#endif /* __SOLARIS__ */
strncpy(s, name, len);
memcpy(s, name, len);
s--;
*s = '/';

View File

@ -247,7 +247,7 @@ char *fuse_add_dirent(char *buf, const char *name, const struct stat *stbuf,
dirent->off = off;
dirent->namelen = namelen;
dirent->type = (stbuf->st_mode & 0170000) >> 12;
strncpy(dirent->name, name, namelen);
memcpy(dirent->name, name, namelen);
if (padlen)
memset(buf + entlen, 0, padlen);