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 | 056b40fd25d3a512e7e4bd2b0dc20c2933fb4c64 (patch) | |
tree | fe857949c247fea9141988c29b203e3ae84b846e | |
parent | 7a67158d34a8507c25611e970805df0f1126592f (diff) | |
download | pw-darwin-056b40fd25d3a512e7e4bd2b0dc20c2933fb4c64.tar.gz pw-darwin-056b40fd25d3a512e7e4bd2b0dc20c2933fb4c64.tar.zst pw-darwin-056b40fd25d3a512e7e4bd2b0dc20c2933fb4c64.zip |
strcpy => strlcpy
Reported by: Coverity
CID: 1006715
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
-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 * |