Date: Mon, 7 Mar 2016 19:14:27 +0000 (UTC) From: Ed Maste <emaste@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r296468 - head/sbin/tunefs Message-ID: <201603071914.u27JERwg035784@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: emaste Date: Mon Mar 7 19:14:26 2016 New Revision: 296468 URL: https://svnweb.freebsd.org/changeset/base/296468 Log: 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 Modified: head/sbin/tunefs/tunefs.c Modified: head/sbin/tunefs/tunefs.c ============================================================================== --- head/sbin/tunefs/tunefs.c Mon Mar 7 18:44:06 2016 (r296467) +++ head/sbin/tunefs/tunefs.c Mon Mar 7 19:14:26 2016 (r296468) @@ -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";
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201603071914.u27JERwg035784>