diff options
| author | Baptiste Daroussin <bapt@FreeBSD.org> | 2015-05-09 19:09:34 +0000 |
|---|---|---|
| committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2015-05-09 19:09:34 +0000 |
| commit | c40fda9eafe03e89a520e779c3640d53528ff0d5 (patch) | |
| tree | 449859d2bfc7d0af8438b155ac51f69ce0d47f97 /pw | |
| parent | f8169403d8544ad1b4afe9e690f9d0b5e7aa9cac (diff) | |
| download | pw-darwin-c40fda9eafe03e89a520e779c3640d53528ff0d5.tar.gz pw-darwin-c40fda9eafe03e89a520e779c3640d53528ff0d5.zip | |
Use snprintf(3) instead of strcpy(3) + strncat(3)
Diffstat (limited to 'pw')
| -rw-r--r-- | pw/pw_user.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/pw/pw_user.c b/pw/pw_user.c index 483148a..0f7dd26 100644 --- a/pw/pw_user.c +++ b/pw/pw_user.c @@ -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); /* |
