mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-26 10:39:23 +01:00
eap: Move eap->method NULL check before first dereference
Move the eap->method NULL check to fix possible crash.
This commit is contained in:
parent
e3c6d2e169
commit
0416749710
11
src/eap.c
11
src/eap.c
@ -186,16 +186,23 @@ static void eap_handle_request(struct eap_state *eap, uint16_t id,
|
|||||||
/* Invalid packets to be ignored */
|
/* Invalid packets to be ignored */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
type = pkt[0];
|
||||||
|
if (type >= __EAP_TYPE_MIN_METHOD && !eap->method) {
|
||||||
|
l_warn("EAP server tried method %i while client had no method "
|
||||||
|
"configured", type);
|
||||||
|
|
||||||
|
goto unsupported_method;
|
||||||
|
}
|
||||||
|
|
||||||
if (id == eap->last_id)
|
if (id == eap->last_id)
|
||||||
op = eap->method->handle_retransmit;
|
op = eap->method->handle_retransmit;
|
||||||
else
|
else
|
||||||
op = eap->method->handle_request;
|
op = eap->method->handle_request;
|
||||||
|
|
||||||
eap->last_id = id;
|
eap->last_id = id;
|
||||||
type = pkt[0];
|
|
||||||
|
|
||||||
if (type >= __EAP_TYPE_MIN_METHOD) {
|
if (type >= __EAP_TYPE_MIN_METHOD) {
|
||||||
if (!eap->method || type != eap->method->request_type) {
|
if (type != eap->method->request_type) {
|
||||||
l_warn("EAP server tried method %i while client was "
|
l_warn("EAP server tried method %i while client was "
|
||||||
"configured for method %i",
|
"configured for method %i",
|
||||||
type, eap->method->request_type);
|
type, eap->method->request_type);
|
||||||
|
Loading…
Reference in New Issue
Block a user