3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2025-01-20 17:54:05 +01:00

eap-wsc: Clean up packet ptr ops

This commit is contained in:
Tim Kourt 2016-10-21 14:36:23 -07:00 committed by Denis Kenzior
parent 79d5353531
commit da433a1c56

View File

@ -838,13 +838,16 @@ static void eap_wsc_handle_request(struct eap_state *eap,
op = pkt[0]; op = pkt[0];
flags = pkt[1]; flags = pkt[1];
pkt += 2;
len -= 2;
/* TODO: Handle fragmentation */ /* TODO: Handle fragmentation */
if (flags != 0) if (flags != 0)
return; return;
switch (op) { switch (op) {
case WSC_OP_START: case WSC_OP_START:
if (len != 2) if (len)
return; return;
if (wsc->state != STATE_EXPECT_START) if (wsc->state != STATE_EXPECT_START)
@ -858,10 +861,10 @@ static void eap_wsc_handle_request(struct eap_state *eap,
wsc->state = STATE_EXPECT_M2; wsc->state = STATE_EXPECT_M2;
return; return;
case WSC_OP_NACK: case WSC_OP_NACK:
if (len <= 2) if (!len)
return; return;
eap_wsc_handle_nack(eap, pkt + 2, len - 2); eap_wsc_handle_nack(eap, pkt, len);
return; return;
case WSC_OP_ACK: case WSC_OP_ACK:
case WSC_OP_DONE: case WSC_OP_DONE:
@ -874,23 +877,23 @@ static void eap_wsc_handle_request(struct eap_state *eap,
break; break;
} }
if (len <= 2) if (!len)
return; return;
switch (wsc->state) { switch (wsc->state) {
case STATE_EXPECT_START: case STATE_EXPECT_START:
return; return;
case STATE_EXPECT_M2: case STATE_EXPECT_M2:
eap_wsc_handle_m2(eap, pkt + 2, len - 2); eap_wsc_handle_m2(eap, pkt, len);
break; break;
case STATE_EXPECT_M4: case STATE_EXPECT_M4:
eap_wsc_handle_m4(eap, pkt + 2, len - 2); eap_wsc_handle_m4(eap, pkt, len);
break; break;
case STATE_EXPECT_M6: case STATE_EXPECT_M6:
eap_wsc_handle_m6(eap, pkt + 2, len - 2); eap_wsc_handle_m6(eap, pkt, len);
break; break;
case STATE_EXPECT_M8: case STATE_EXPECT_M8:
eap_wsc_handle_m8(eap, pkt + 2, len - 2); eap_wsc_handle_m8(eap, pkt, len);
break; break;
case STATE_FINISHED: case STATE_FINISHED:
eap_wsc_send_nack(eap, WSC_CONFIGURATION_ERROR_NO_ERROR); eap_wsc_send_nack(eap, WSC_CONFIGURATION_ERROR_NO_ERROR);