summaryrefslogtreecommitdiffstats
path: root/pw/pw_user.c
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2012-05-15 00:42:12 +0000
committerAlexander Motin <mav@FreeBSD.org>2012-05-15 00:42:12 +0000
commitece00476ae97c736665d4bf73a744a3ff57a4020 (patch)
tree428218f4293355ba7d1e99722d1676fbde7e6e10 /pw/pw_user.c
parent7c00ce99fd28d2f4e48085da6ba1d3946f80012d (diff)
parenta93fc7681bb6cbb582cc0c16fe440ae3087720be (diff)
downloadpw-darwin-ece00476ae97c736665d4bf73a744a3ff57a4020.tar.gz
pw-darwin-ece00476ae97c736665d4bf73a744a3ff57a4020.zip
MFC
Diffstat (limited to 'pw/pw_user.c')
-rw-r--r--pw/pw_user.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/pw/pw_user.c b/pw/pw_user.c
index 0001a41..b59789c 100644
--- a/pw/pw_user.c
+++ b/pw/pw_user.c
@@ -1028,6 +1028,7 @@ pw_pwcrypt(char *password)
{
int i;
char salt[SALTSIZE + 1];
+ char *cryptpw;
static char buf[256];
@@ -1038,7 +1039,10 @@ pw_pwcrypt(char *password)
salt[i] = chars[arc4random_uniform(sizeof(chars) - 1)];
salt[SALTSIZE] = '\0';
- return strcpy(buf, crypt(password, salt));
+ cryptpw = crypt(password, salt);
+ if (cryptpw == NULL)
+ errx(EX_CONFIG, "crypt(3) failure");
+ return strcpy(buf, cryptpw);
}