aboutsummaryrefslogtreecommitdiff
path: root/libbb/pw_encrypt.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/pw_encrypt.c')
-rw-r--r--libbb/pw_encrypt.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/libbb/pw_encrypt.c b/libbb/pw_encrypt.c
index 0e4eb9f8a..ac79f839f 100644
--- a/libbb/pw_encrypt.c
+++ b/libbb/pw_encrypt.c
@@ -39,10 +39,7 @@ extern char *pw_encrypt(const char *clear, const char *salt)
/* if crypt (a nonstandard crypt) returns a string too large,
truncate it so we don't overrun buffers and hope there is
enough security in what's left */
- if (strlen(cp) > sizeof(cipher)-1) {
- cp[sizeof(cipher)-1] = 0;
- }
- strcpy(cipher, cp);
+ safe_strncpy(cipher, cp, sizeof(cipher));
return cipher;
}