diff options
author | Saurav Babu <saurav.babu@samsung.com> | 2018-05-23 17:20:59 +0530 |
---|---|---|
committer | Saurav Babu <saurav.babu@samsung.com> | 2018-05-23 17:21:49 +0530 |
commit | 3a843d0d6419f18bd972b0fb57541da194bd37c8 (patch) | |
tree | 3f47c298e3e941e1e934d56f3c4338d72ed8a3fe | |
parent | 5d9d3391d8d6f853b47c208499e8b760170120ae (diff) | |
download | connman-3a843d0d6419f18bd972b0fb57541da194bd37c8.tar.gz connman-3a843d0d6419f18bd972b0fb57541da194bd37c8.tar.bz2 connman-3a843d0d6419f18bd972b0fb57541da194bd37c8.zip |
gsupplicant: Fixed crash issuesubmit/tizen/20180523.121952accepted/tizen/unified/20180523.144438
Change-Id: I568ffb360881ed78ac3c119c458220829d582d56
Signed-off-by: Saurav Babu <saurav.babu@samsung.com>
-rw-r--r-- | gsupplicant/supplicant.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index a403c202..23fa2366 100644 --- a/gsupplicant/supplicant.c +++ b/gsupplicant/supplicant.c @@ -1596,6 +1596,8 @@ void *g_supplicant_network_get_wifi_vsie(GSupplicantNetwork *network) unsigned char *vsie = NULL; for (list = network->vsie_list; list; list = list->next) { unsigned char *ie = (unsigned char *)list->data; + if (ie == NULL) + continue; vsie = (unsigned char *)g_try_malloc0(ie[1]+2); // tag number size(1), tag length size(1) if (vsie) { @@ -2181,8 +2183,11 @@ static void bss_process_ies(DBusMessageIter *iter, void *user_data) } if(ie[0] == WLAN_EID_COUNTRY && ie[1] >= 2) { - memcpy(bss->country_code, ie+2, COUNTRY_CODE_LENGTH); - continue; + /* Add country code only if it is a valid alphabet */ + if (ie[2] >= 65 && ie[2] <= 90 && ie[3] >= 65 && ie[3] <= 90) { + memcpy(bss->country_code, ie+2, COUNTRY_CODE_LENGTH); + continue; + } } #endif if (ie[0] != WMM_WPA1_WPS_INFO || ie[1] < WPS_INFO_MIN_LEN || |