aboutsummaryrefslogtreecommitdiffstats
path: root/main/libc0.9.32/0018-libcrypt-do-not-cast-away-const-of-key-salt.patch
blob: d79671739be79d18df0ee0629b65c10124083bef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From c6363f33f5af361fea483dd6a7e0f42278f913bf Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Sun, 20 Nov 2011 02:34:49 -0500
Subject: [PATCH] libcrypt: do not cast away const of key/salt

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
(cherry picked from commit 4a2b0641a3818ad14b886907368b6f6735615f6d)
---
 libcrypt/crypt.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libcrypt/crypt.c b/libcrypt/crypt.c
index 8b361d3..89a2614 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);
 }
-- 
1.7.8