From 6a1cc0fddf9825f4d02e88a782cc2074add2fb90 Mon Sep 17 00:00:00 2001 From: jasondrogba <757104667@qq.com> Date: Tue, 12 Mar 2024 14:29:23 +0800 Subject: [PATCH] Avoid gcc 11 strncpy warnings --- lib/fuse.c | 2 +- lib/fuse_lowlevel.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/fuse.c b/lib/fuse.c index fa0a8149b..a428d1d90 100644 --- a/lib/fuse.c +++ b/lib/fuse.c @@ -905,7 +905,7 @@ static char *add_name(char **buf, unsigned *bufsize, char *s, const char *name) *bufsize = newbufsize; } s -= len; - strncpy(s, name, len); + memcpy(s, name, len); s--; *s = '/'; diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index ff03c6301..a345cd029 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -260,7 +260,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);