3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-26 02:19:26 +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:
Andrew Zaborowski 2017-05-22 10:49:49 +02:00 committed by Denis Kenzior
parent e3c6d2e169
commit 0416749710

View File

@ -186,16 +186,23 @@ static void eap_handle_request(struct eap_state *eap, uint16_t id,
/* Invalid packets to be ignored */
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)
op = eap->method->handle_retransmit;
else
op = eap->method->handle_request;
eap->last_id = id;
type = pkt[0];
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 "
"configured for method %i",
type, eap->method->request_type);