diff options
author | Alan Somers <asomers@FreeBSD.org> | 2017-05-10 15:38:06 +0000 |
---|---|---|
committer | Alan Somers <asomers@FreeBSD.org> | 2017-05-10 15:38:06 +0000 |
commit | 5714d4d1a6ff8cc12affc1b746f04b14882d362f (patch) | |
tree | d056bc139ba562c3051eb674d465360cb42e07ad /pw | |
parent | 1234cbbb41b6bf57c7094a5e9d015db7b303c44c (diff) | |
download | pw-darwin-5714d4d1a6ff8cc12affc1b746f04b14882d362f.tar.gz pw-darwin-5714d4d1a6ff8cc12affc1b746f04b14882d362f.tar.zst pw-darwin-5714d4d1a6ff8cc12affc1b746f04b14882d362f.zip |
strcpy => strlcpy
Reported by: Coverity
CID: 1006715
MFC after: 3 weeks
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 5466bec..cf38e9c 100644 --- a/pw/pw_user.c +++ b/pw/pw_user.c @@ -33,6 +33,7 @@ static const char rcsid[] = #include <sys/param.h> #include <sys/types.h> +#include <assert.h> #include <ctype.h> #include <dirent.h> #include <err.h> @@ -501,7 +502,8 @@ pw_pwcrypt(char *password) cryptpw = crypt(password, salt); if (cryptpw == NULL) errx(EX_CONFIG, "crypt(3) failure"); - return strcpy(buf, cryptpw); + assert(strlcpy(buf, cryptpw, sizeof(buf)) < sizeof(buf)); + return (buf); } static char * |