From: Luke Howard Date: Mon, 28 Mar 2011 23:01:18 +0000 (+1100) Subject: correct importing of partial attribute contexts X-Git-Tag: tr-beta1~251 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=moonshot.git;a=commitdiff_plain;h=04f114c3956f6509485bf6956118cf2d5ecc3ef5 correct importing of partial attribute contexts Conflicts: mech_eap/import_sec_context.c --- diff --git a/mech_eap/import_sec_context.c b/mech_eap/import_sec_context.c index 7f9cd2f..d571bca 100644 --- a/mech_eap/import_sec_context.c +++ b/mech_eap/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; }