diff options
author | Alan Somers <asomers@FreeBSD.org> | 2017-05-10 16:06:22 +0000 |
---|---|---|
committer | Alan Somers <asomers@FreeBSD.org> | 2017-05-10 16:06:22 +0000 |
commit | a011bc90ddf52787b7dca3cc3caf01fe3b1a88c1 (patch) | |
tree | 7d050ede046bbd2acdafd583db4c123ead495684 /pw | |
parent | 5714d4d1a6ff8cc12affc1b746f04b14882d362f (diff) | |
download | pw-darwin-a011bc90ddf52787b7dca3cc3caf01fe3b1a88c1.tar.gz pw-darwin-a011bc90ddf52787b7dca3cc3caf01fe3b1a88c1.tar.zst pw-darwin-a011bc90ddf52787b7dca3cc3caf01fe3b1a88c1.zip |
Don't depend on assert(3) getting evaluated
Reported by: imp
MFC after: 3 weeks
X-MFC-With: 318141, 318143
Sponsored by: Spectra Logic Corp
Diffstat (limited to 'pw')
-rw-r--r-- | pw/pw_user.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pw/pw_user.c b/pw/pw_user.c index cf38e9c..76849ba 100644 --- a/pw/pw_user.c +++ b/pw/pw_user.c @@ -491,6 +491,7 @@ pw_pwcrypt(char *password) char salt[SALTSIZE + 1]; char *cryptpw; static char buf[256]; + size_t pwlen; /* * Calculate a salt value @@ -502,7 +503,8 @@ pw_pwcrypt(char *password) cryptpw = crypt(password, salt); if (cryptpw == NULL) errx(EX_CONFIG, "crypt(3) failure"); - assert(strlcpy(buf, cryptpw, sizeof(buf)) < sizeof(buf)); + pwlen = strlcpy(buf, cryptpw, sizeof(buf)); + assert(pwlen < sizeof(buf)); return (buf); } |