From: Jaya Prakash Sangaru Date: Wed, 8 Aug 2018 04:52:52 +0000 (+0530) Subject: [9610][7885][7872] wlbt: wifi-hal fix prevent issue X-Git-Tag: MMI-QSBS30.62-17-8~24 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cdcc8b216042979e1ef1ef841c179730ff890cbf;p=GitHub%2FMotorolaMobilityLLC%2Fhardware-samsung_slsi-scsc_wifibt-wifi_hal.git [9610][7885][7872] wlbt: wifi-hal fix prevent issue If driver does not send mac/cluster address in SLSI_NAN_EVENT_DISCOVERY_ENGinE wifi-hal can crash in processNanDiscoveryEvent(). Avoid such unwanted crash. SCSC-Bug-Id: SSB-42660 Change-Id: I50184d43647e98ba00fbe3f6c4b2762f9c7fdb41 Signed-off-by: Jaya Prakash Sangaru --- diff --git a/wifi_nan.cpp b/wifi_nan.cpp index 358bd86..4c1a208 100755 --- a/wifi_nan.cpp +++ b/wifi_nan.cpp @@ -623,7 +623,7 @@ class NanCommand : public WifiCommand { int processNanDiscoveryEvent(WifiEvent &event) { NanDiscEngEventInd ind; memset(&ind,0,sizeof(ind)); - u8 *addr; + u8 *addr = NULL; for(nl_iterator nl_itr((struct nlattr *)event.get_vendor_data()); nl_itr.has_next(); nl_itr.next()) { switch(nl_itr.get_type()) { @@ -638,10 +638,14 @@ class NanCommand : public WifiCommand { return NL_SKIP; } } - if (ind.event_type == NAN_EVENT_ID_DISC_MAC_ADDR) - memcpy(ind.data.mac_addr.addr, addr, NAN_MAC_ADDR_LEN); - else - memcpy(ind.data.cluster.addr, addr, NAN_MAC_ADDR_LEN); + if (addr) { + if (ind.event_type == NAN_EVENT_ID_DISC_MAC_ADDR) + memcpy(ind.data.mac_addr.addr, addr, NAN_MAC_ADDR_LEN); + else + memcpy(ind.data.cluster.addr, addr, NAN_MAC_ADDR_LEN); + } else { + ALOGE("processNanDiscoveryEvent: No Mac/cluster Address"); + } if (callbackEventHandler.EventDiscEngEvent) callbackEventHandler.EventDiscEngEvent(&ind);