From 4fe1ac37081ea83f711981f5bda6ea1a38ee1575 Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Tue, 29 Mar 2011 10:01:18 +1100 Subject: [PATCH] correct importing of partial attribute contexts Conflicts: mech_eap/import_sec_context.c --- import_sec_context.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/import_sec_context.c b/import_sec_context.c index 7f9cd2f..d571bca 100644 --- a/import_sec_context.c +++ b/import_sec_context.c @@ -58,7 +58,15 @@ gssEapImportPartialContext(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 @@ gssEapImportPartialContext(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; } -- 2.1.4