]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
eap_proxy: Confirm eap_proxy initialization before reading SIM info
authorNaresh Jayaram <c_njayar@qti.qualcomm.com>
Wed, 23 Oct 2013 16:17:14 +0000 (19:17 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 23 Oct 2013 17:51:39 +0000 (20:51 +0300)
Trying to access the SIM card details without checking if the eap_proxy
layer has been initialized can results in a crash. Address this by
sending the request for the IMSI through eapol_supp_sm.c which can
verify that eap_proxy has been initialized.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

src/eapol_supp/eapol_supp_sm.c
src/eapol_supp/eapol_supp_sm.h
wpa_supplicant/wpa_supplicant.c

index 03ec2cb4c806c698d0d6bcf102899c91bba09e5a..d34df7c2fcb14364398917391d29f4af3d394972 100644 (file)
@@ -2051,3 +2051,15 @@ int eapol_sm_failed(struct eapol_sm *sm)
                return 0;
        return !sm->eapSuccess && sm->eapFail;
 }
+
+
+int eapol_sm_get_eap_proxy_imsi(struct eapol_sm *sm, char *imsi, size_t *len)
+{
+#ifdef CONFIG_EAP_PROXY
+       if (sm->eap_proxy == NULL)
+               return -1;
+       return eap_proxy_get_imsi(imsi, len);
+#else /* CONFIG_EAP_PROXY */
+       return -1;
+#endif /* CONFIG_EAP_PROXY */
+}
index 6faf816d4232a7bad3c4b576e30b2ed43c600cc3..54e8a2711d8df1d1d5558036d902e6c4fa269448 100644 (file)
@@ -292,6 +292,7 @@ const char * eapol_sm_get_method_name(struct eapol_sm *sm);
 void eapol_sm_set_ext_pw_ctx(struct eapol_sm *sm,
                             struct ext_password_data *ext);
 int eapol_sm_failed(struct eapol_sm *sm);
+int eapol_sm_get_eap_proxy_imsi(struct eapol_sm *sm, char *imsi, size_t *len);
 #else /* IEEE8021X_EAPOL */
 static inline struct eapol_sm *eapol_sm_init(struct eapol_ctx *ctx)
 {
index 4be84f021267b09b3eacdeccc4b93874d6e15c22..8ca88408b496853b8d45558f7512c69e7135444d 100644 (file)
@@ -3064,7 +3064,8 @@ next_driver:
 #ifdef CONFIG_EAP_PROXY
 {
        size_t len;
-       wpa_s->mnc_len = eap_proxy_get_imsi(wpa_s->imsi, &len);
+       wpa_s->mnc_len = eapol_sm_get_eap_proxy_imsi(wpa_s->eapol, wpa_s->imsi,
+                                                    &len);
        if (wpa_s->mnc_len > 0) {
                wpa_s->imsi[len] = '\0';
                wpa_printf(MSG_DEBUG, "eap_proxy: IMSI %s (MNC length %d)",