tunefs: clear the entire previous label when setting a new one

strlcpy(3) null terminates but does not zero-fill the buffer, so would
leave beind any portion of the previous volume label longer than the
new one.

Note that tunefs only allows -L args up to a length of MAXVOLLEN-1, so
the stored label will be null-terminated (whether or not required by
UFS).

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Ed Maste
2016-03-07 19:14:26 +00:00
parent 3cfce8e4df
commit f9c821083a
+1 -1
View File
@@ -316,7 +316,7 @@ main(int argc, char *argv[])
}
if (Lflag) {
name = "volume label";
strlcpy(sblock.fs_volname, Lvalue, MAXVOLLEN);
strncpy(sblock.fs_volname, Lvalue, MAXVOLLEN);
}
if (aflag) {
name = "POSIX.1e ACLs";