svn commit: r282683 - head/usr.sbin/pw

Baptiste Daroussin bapt at FreeBSD.org
Sat May 9 19:09:35 UTC 2015


Author: bapt
Date: Sat May  9 19:09:34 2015
New Revision: 282683
URL: https://svnweb.freebsd.org/changeset/base/282683

Log:
  Use snprintf(3) instead of strcpy(3) + strncat(3)

Modified:
  head/usr.sbin/pw/pw_user.c

Modified: head/usr.sbin/pw/pw_user.c
==============================================================================
--- head/usr.sbin/pw/pw_user.c	Sat May  9 19:00:41 2015	(r282682)
+++ head/usr.sbin/pw/pw_user.c	Sat May  9 19:09:34 2015	(r282683)
@@ -185,8 +185,7 @@ pw_user(struct userconf * cnf, int mode,
 			 * But we create a symlink from cnf->home -> "/usr" -> cnf->home
 			 */
 			if (strchr(cnf->home+1, '/') == NULL) {
-				strcpy(dbuf, "/usr");
-				strncat(dbuf, cnf->home, MAXPATHLEN-5);
+				snprintf(dbuf, MAXPATHLEN, "/usr%s", cnf->home);
 				if (mkdir(dbuf, _DEF_DIRMODE) != -1 || errno == EEXIST) {
 					chown(dbuf, 0, 0);
 					/*


More information about the svn-src-all mailing list