Try to make indent formatting less horrible
[oweals/busybox.git] / libbb / pw_encrypt.c
index 0e4eb9f8a8635a6207ff7cb635e8e522ad57d6a8..ce6078539f02106e80768d934f7771524e0df86c 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * Utility routine.
  *
- * Copyright (C) 1999-2002 by Erik Andersen <andersee@debian.org>
+ * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -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;
 }