From 5bf12d2604322220542f6ce610405708997fd65d Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Tue, 29 Mar 2011 09:59:17 +1100 Subject: [PATCH] correct importing of partial attribute contexts --- mech_eap/import_sec_context.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/mech_eap/import_sec_context.c b/mech_eap/import_sec_context.c index 7f81b40..978970a 100644 --- a/mech_eap/import_sec_context.c +++ b/mech_eap/import_sec_context.c @@ -58,7 +58,15 @@ importPartialRadiusContext(OM_uint32 *minor, unsigned char *p = *pBuf; size_t remain = *pRemain; gss_buffer_desc buf; - size_t serverLen; + size_t ctxLength, serverLen; + + /* Length of partial RADIUS context */ + CHECK_REMAIN(4); + ctxLength = load_uint32_be(p); + UPDATE_REMAIN(4); + + CHECK_REMAIN(ctxLength); + remain = ctxLength; /* check against partial context length */ /* Selected RADIUS server */ CHECK_REMAIN(4); @@ -96,8 +104,12 @@ importPartialRadiusContext(OM_uint32 *minor, UPDATE_REMAIN(buf.length); } +#ifdef GSSEAP_DEBUG + assert(remain == 0); +#endif + *pBuf = p; - *pRemain = remain; + *pRemain -= 4 + ctxLength; return GSS_S_COMPLETE; } @@ -261,7 +273,7 @@ importConversation(OM_uint32 *minor, return GSS_S_COMPLETE; } -static OM_uint32 +OM_uint32 gssEapImportContext(OM_uint32 *minor, gss_buffer_t token, gss_ctx_id_t ctx) -- 2.1.4