Blame SOURCES/freeradius-rlm_pap-overflow.patch

08a4ed
From ff5147c9e5088c7cf5c0b6ec6bfdd3a9d2042a28 Mon Sep 17 00:00:00 2001
08a4ed
From: Arran Cudbard-Bell <a.cudbardb@freeradius.org>
08a4ed
Date: Thu, 13 Feb 2014 13:49:54 +0000
08a4ed
Subject: [PATCH 1/1] Fix potential crash with SSHA and salts > 44bytes
08a4ed
08a4ed
---
08a4ed
 src/modules/rlm_pap/rlm_pap.c | 10 ++++++----
08a4ed
 1 file changed, 6 insertions(+), 4 deletions(-)
08a4ed
08a4ed
diff --git a/src/modules/rlm_pap/rlm_pap.c b/src/modules/rlm_pap/rlm_pap.c
08a4ed
index 689acf0..1bf6d4e 100644
08a4ed
--- a/src/modules/rlm_pap/rlm_pap.c
08a4ed
+++ b/src/modules/rlm_pap/rlm_pap.c
08a4ed
@@ -123,7 +123,7 @@ static int mod_instantiate(CONF_SECTION *conf, void *instance)
08a4ed
 static void normify(REQUEST *request, VALUE_PAIR *vp, size_t min_length)
08a4ed
 {
08a4ed
 
08a4ed
-	uint8_t buffer[64];
08a4ed
+	uint8_t buffer[256];
08a4ed
 
08a4ed
 	if (min_length >= sizeof(buffer)) return; /* paranoia */
08a4ed
 
08a4ed
@@ -132,9 +132,10 @@ static void normify(REQUEST *request, VALUE_PAIR *vp, size_t min_length)
08a4ed
 	 */
08a4ed
 	if (vp->length >= (2 * min_length)) {
08a4ed
 		size_t decoded;
08a4ed
-		decoded = fr_hex2bin(buffer, vp->vp_strvalue, vp->length >> 1);
08a4ed
+		decoded = fr_hex2bin(buffer, vp->vp_strvalue, sizeof(buffer));
08a4ed
 		if (decoded == (vp->length >> 1)) {
08a4ed
-			RDEBUG2("Normalizing %s from hex encoding", vp->da->name);
08a4ed
+			RDEBUG2("Normalizing %s from hex encoding, %zu bytes -> %zu bytes",
08a4ed
+				vp->da->name, vp->length, decoded);
08a4ed
 			pairmemcpy(vp, buffer, decoded);
08a4ed
 			return;
08a4ed
 		}
08a4ed
@@ -150,7 +151,8 @@ static void normify(REQUEST *request, VALUE_PAIR *vp, size_t min_length)
08a4ed
 					   sizeof(buffer));
08a4ed
 		if (decoded < 0) return;
08a4ed
 		if (decoded >= (ssize_t) min_length) {
08a4ed
-			RDEBUG2("Normalizing %s from base64 encoding", vp->da->name);
08a4ed
+			RDEBUG2("Normalizing %s from base64 encoding, %zu bytes -> %zu bytes",
08a4ed
+				vp->da->name, vp->length, decoded);
08a4ed
 			pairmemcpy(vp, buffer, decoded);
08a4ed
 			return;
08a4ed
 		}
08a4ed
-- 
08a4ed
1.8.5.3
08a4ed