[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 <j.sangaru@samsung.com>
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 @@
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 @@
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);