OSDN Git Service

libcrypt: do not cast away const of key/salt
authorMike Frysinger <vapier@gentoo.org>
Sun, 20 Nov 2011 07:34:49 +0000 (02:34 -0500)
committerMike Frysinger <vapier@gentoo.org>
Sun, 20 Nov 2011 07:35:00 +0000 (02:35 -0500)
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
libcrypt/crypt.c

index 8b361d3..89a2614 100644 (file)
 
 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);
 }