Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid gcc 11 strncpy warning #4

Open
wants to merge 1 commit into
base: fuse_2_9_5_customize_multi_threads
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/fuse.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '/';

Expand Down
2 changes: 1 addition & 1 deletion lib/fuse_lowlevel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down