Fix segmentation fault on EAP-TTLS phase 2 EAP method init failure

This is based on a patch and report by Masashi Honma
<honma@ictec.co.jp>. The issue is more generic than just TNC, though,
since failure to initialize any phase 2 EAP method can result in NULL
dereference.
This commit is contained in:
Jouni Malinen 2009-03-13 17:53:13 +02:00 committed by Jouni Malinen
parent 0d308bc074
commit 99bff8430f

View file

@ -954,7 +954,7 @@ static int eap_ttls_phase2_eap_init(struct eap_sm *sm,
sm->init_phase2 = 1; sm->init_phase2 = 1;
data->phase2_priv = data->phase2_method->init(sm); data->phase2_priv = data->phase2_method->init(sm);
sm->init_phase2 = 0; sm->init_phase2 = 0;
return 0; return data->phase2_priv == NULL ? -1 : 0;
} }