Skip to content

Commit 965fe93

Browse files
committed
break out length checks into separate error message
1 parent c0e0e4c commit 965fe93

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,8 +589,16 @@ static int CC_HINT(nonnull) mod_process(void *arg, eap_handler_t *handler)
589589
}
590590

591591
length = (eap_ds->response->type.data[2] << 8) | eap_ds->response->type.data[3];
592-
if ((length < (5 + 49)) || (length > (256 + 5 + 49)) || (length != (eap_ds->response->type.length - 5))) {
593-
REDEBUG("Response contains invalid length %zd", length);
592+
if ((length < (5 + 49)) || (length > (256 + 5 + 49))) {
593+
REDEBUG("Response contains invalid MS-Length %zd");
594+
return 0;
595+
}
596+
597+
/*
598+
* type.length is already updated to remove the EAP header.
599+
*/
600+
if (length != eap_ds->response->type.length) {
601+
REDEBUG("Response contains invalid MS-Length %zd vs %zd", length, eap_ds->response->type.length);
594602
return 0;
595603
}
596604

0 commit comments

Comments
 (0)