aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2015-05-09 19:12:16 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2015-05-09 19:12:16 +0000
commitb2298745ac1fc3c41312c87a322bf160fdd7693d (patch)
tree0fa5d1577a648598b66cce55f0e0acf896b345a4 /usr.sbin
parenta546448b8d27b6e89489be71b91da848147673ef (diff)
Notes
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pw/pw_user.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/usr.sbin/pw/pw_user.c b/usr.sbin/pw/pw_user.c
index 0f7dd2691c99..dc9a2d8e7943 100644
--- a/usr.sbin/pw/pw_user.c
+++ b/usr.sbin/pw/pw_user.c
@@ -363,11 +363,9 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args)
if (mode == M_LOCK) {
if (strncmp(pwd->pw_passwd, locked_str, sizeof(locked_str)-1) == 0)
errx(EX_DATAERR, "user '%s' is already locked", pwd->pw_name);
- passtmp = malloc(strlen(pwd->pw_passwd) + sizeof(locked_str));
+ asprintf(&passtmp, "%s%s", locked_str, pwd->pw_passwd);
if (passtmp == NULL) /* disaster */
errx(EX_UNAVAILABLE, "out of memory");
- strcpy(passtmp, locked_str);
- strcat(passtmp, pwd->pw_passwd);
pwd->pw_passwd = passtmp;
edited = 1;
} else if (mode == M_UNLOCK) {