From ef61c82529db5cb53328afceba6d44ff2ee08f3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Sat, 7 Mar 2020 11:56:46 +0100 Subject: [PATCH] Avoided using a truncate strncpy() in the fuse library Replace strncpy() by memcpy() when the exact size if known, thus silencing the compiler warnings. --- libfuse-lite/fuse.c | 2 +- libfuse-lite/fuse_lowlevel.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libfuse-lite/fuse.c b/libfuse-lite/fuse.c index 256bed0f..6f9242b7 100644 --- a/libfuse-lite/fuse.c +++ b/libfuse-lite/fuse.c @@ -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 = '/'; diff --git a/libfuse-lite/fuse_lowlevel.c b/libfuse-lite/fuse_lowlevel.c index fb93b074..a2a58278 100644 --- a/libfuse-lite/fuse_lowlevel.c +++ b/libfuse-lite/fuse_lowlevel.c @@ -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);