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

This commit is contained in:
Baptiste Daroussin 2015-05-09 19:09:34 +00:00
parent a8e37ee0ac
commit 0602630cc7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=282683

View File

@ -185,8 +185,7 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args)
* 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);
/*