aboutsummaryrefslogtreecommitdiffstats
path: root/src/eap_server/eap_sim.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2007-12-01 04:18:41 (GMT)
committerJouni Malinen <j@w1.fi>2007-12-01 04:18:41 (GMT)
commitb3d40e10b8db66678ba5d356f8380f7104e8a729 (patch)
tree34be7503882de62c53d64254a532aeac347bdb7e /src/eap_server/eap_sim.c
parent7cadbf623f48b6e33fec6f94e52710cf495fac2f (diff)
downloadhostap-history-b3d40e10b8db66678ba5d356f8380f7104e8a729.zip
hostap-history-b3d40e10b8db66678ba5d356f8380f7104e8a729.tar.gz
hostap-history-b3d40e10b8db66678ba5d356f8380f7104e8a729.tar.bz2
Use eap_hdr_validate() instead of local implementation to validate EAP
header.
Diffstat (limited to 'src/eap_server/eap_sim.c')
-rw-r--r--src/eap_server/eap_sim.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/eap_server/eap_sim.c b/src/eap_server/eap_sim.c
index f08a131..0700e5c 100644
--- a/src/eap_server/eap_sim.c
+++ b/src/eap_server/eap_sim.c
@@ -265,17 +265,17 @@ static Boolean eap_sim_check(struct eap_sm *sm, void *priv,
u8 *respData, size_t respDataLen)
{
struct eap_sim_data *data = priv;
- struct eap_hdr *resp;
- u8 *pos, subtype;
+ const u8 *pos;
+ size_t len;
+ u8 subtype;
- resp = (struct eap_hdr *) respData;
- pos = (u8 *) (resp + 1);
- if (respDataLen < sizeof(*resp) + 4 || *pos != EAP_TYPE_SIM ||
- (be_to_host16(resp->length)) > respDataLen) {
+ pos = eap_hdr_validate(EAP_VENDOR_IETF, EAP_TYPE_SIM,
+ respData, respDataLen, &len);
+ if (pos == NULL || len < 3) {
wpa_printf(MSG_INFO, "EAP-SIM: Invalid frame");
return TRUE;
}
- subtype = pos[1];
+ subtype = *pos;
if (subtype == EAP_SIM_SUBTYPE_CLIENT_ERROR)
return FALSE;