summaryrefslogtreecommitdiff
path: root/libcrypt/crypt.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-11-20 02:34:49 -0500
committerMike Frysinger <vapier@gentoo.org>2011-11-20 02:35:00 -0500
commit4a2b0641a3818ad14b886907368b6f6735615f6d (patch)
tree21a2b8b93a3a4c9be3603c2eaef1803c08b3698f /libcrypt/crypt.c
parent69cba61dd27f2a9c4c34f596ed9d1b7cd0441f74 (diff)
libcrypt: do not cast away const of key/salt
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'libcrypt/crypt.c')
-rw-r--r--libcrypt/crypt.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libcrypt/crypt.c b/libcrypt/crypt.c
index 8b361d393..89a26149c 100644
--- a/libcrypt/crypt.c
+++ b/libcrypt/crypt.c
@@ -12,10 +12,13 @@
char *crypt(const char *key, const char *salt)
{
+ const unsigned char *ukey = (const unsigned char *)key;
+ const unsigned char *usalt = (const unsigned char *)salt;
+
/* First, check if we are supposed to be using the MD5 replacement
* instead of DES... */
if (salt[0]=='$' && salt[1]=='1' && salt[2]=='$')
- return __md5_crypt((unsigned char*)key, (unsigned char*)salt);
+ return __md5_crypt(ukey, usalt);
else
- return __des_crypt((unsigned char*)key, (unsigned char*)salt);
+ return __des_crypt(ukey, usalt);
}