diff options
author | emaste <emaste@FreeBSD.org> | 2016-03-07 19:14:26 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2016-03-07 19:14:26 +0000 |
commit | b312d89ffd87ca6261238586e1ad8eba74c87256 (patch) | |
tree | db1ad4bf5fda67e18d02cd40bebc6c0bc3899587 | |
parent | 1e048a7127a7ef3ebaa416e31aaa32769732a0b6 (diff) | |
download | FreeBSD-src-b312d89ffd87ca6261238586e1ad8eba74c87256.zip FreeBSD-src-b312d89ffd87ca6261238586e1ad8eba74c87256.tar.gz |
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
-rw-r--r-- | sbin/tunefs/tunefs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sbin/tunefs/tunefs.c b/sbin/tunefs/tunefs.c index 15c6cf0..b03cdde7 100644 --- a/sbin/tunefs/tunefs.c +++ b/sbin/tunefs/tunefs.c @@ -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"; |