Patchwork [WLAN] : Fix crash for NULL pointer handling

login
register
mail settings
Submitter Manish BANSAL
Date July 3, 2012, 10:03 a.m.
Message ID <28CDD66F076AAB40B7C8338A697290020DB90911D8@EXDCVYMBSTM006.EQ1STM.local>
Download mbox | patch
Permalink /patch/168780/
State Changes Requested
Headers show

Comments

Manish BANSAL - July 3, 2012, 10:03 a.m.
Hello,

This patch add NULL check before passing the parameter to function wpa_supplicant_wps_event_er_set_sel_reg().

=====================================================================

Regards,
Manish Bansal
Jouni Malinen - July 4, 2012, 6:14 p.m.
On Tue, Jul 03, 2012 at 12:03:40PM +0200, Manish BANSAL wrote:
> This patch add NULL check before passing the parameter to function wpa_supplicant_wps_event_er_set_sel_reg().

Could you please describe what operations were used to trigger this? As
far as I can tell, there are two places where
WPS_EV_ER_SET_SELECTED_REGISTRAR is indicated and both of those include
a pointer to the union wps_event_data. As such, I'm not sure how this
could result in a crash.

As far as contributing changes to hostap.git is concerned, please read
the CONTRIBUTIONS file in the top directory and send the patch with the
Signed-hostap: line included in the commit log.

Patch

================================================================
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index 222c8fc..75631e1 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -656,7 +656,8 @@  static void wpa_supplicant_wps_event(void *ctx, enum wps_event event,
                                                        &data->ap_settings);
                break;
        case WPS_EV_ER_SET_SELECTED_REGISTRAR:
-               wpa_supplicant_wps_event_er_set_sel_reg(wpa_s,
+               if (data)
+                       wpa_supplicant_wps_event_er_set_sel_reg(wpa_s,
                                                        &data->set_sel_reg);
                break;
        }