]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commit
misc/fuse2fs: avoid error-prone strncpy() pattern
authorEric Biggers <ebiggers@google.com>
Sat, 21 Jan 2023 20:32:22 +0000 (12:32 -0800)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 27 Jan 2023 17:38:31 +0000 (12:38 -0500)
commit44ee1fb80bd347ba92c38a4e60060229f671dcd8
treefae4f4226f6b4f2d9d0e80ec1ad2f54977f60619
parent58830e58551aef70e19c992f880e378125e5d9d9
misc/fuse2fs: avoid error-prone strncpy() pattern

'strncpy(dst, src, strlen(src))' is usually wrong, as it doesn't copy
the null terminator.  For this reason, it causes a -Wstringop-truncation
warning with gcc 8 and later.

The code happens to be correct anyway, since the destination buffer is
zero-initialized.  But to avoid relying on this, let's just copy the
terminating null.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
misc/fuse2fs.c