if (vp->vp_length < 4) return RLM_MODULE_NOOP;
+ if ((vp->vp_octets[0] == 0) ||( vp->vp_octets[0] > 6)) {
+ RDEBUG("EAP header byte zero has invalid value");
+ return RLM_MODULE_REJECT;
+ }
+
length = (vp->vp_octets[2] << 8) | vp->vp_octets[3];
- if (length != vp->vp_length) return RLM_MODULE_REJECT;
+ if (length != vp->vp_length) {
+ RDEBUG("EAP length does not match attribute length");
+ return RLM_MODULE_REJECT;
+ }
+ if (vp->vp_octets[0] != PW_EAP_REQUEST) return RLM_MODULE_NOOP;
if (!inst->max_eap_type) return RLM_MODULE_NOOP;
- if (vp->vp_octets[4] > inst->max_eap_type) return RLM_MODULE_REJECT;
+ if (vp->vp_octets[4] > inst->max_eap_type) {
+ RDEBUG("EAP method %u is too large", vp->vp_octets[0]);
+ return RLM_MODULE_REJECT;
+ }
return RLM_MODULE_NOOP;
}