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