wifi_hal: Fix KW issue
Add length check before memcpy
Change-Id: I4a53053574957003385ed51abe4fa7b1cb208d54
CRs-Fixed: 3446913
diff --git a/qcwcn/wifi_hal/tdls.cpp b/qcwcn/wifi_hal/tdls.cpp
index 2082fef..c54928f 100644
--- a/qcwcn/wifi_hal/tdls.cpp
+++ b/qcwcn/wifi_hal/tdls.cpp
@@ -122,9 +122,15 @@
__FUNCTION__);
return WIFI_ERROR_INVALID_ARGS;
}
+ if (nla_len(tb_vendor[QCA_WLAN_VENDOR_ATTR_TDLS_MAC_ADDR]) != sizeof(mac_addr))
+ {
+ ALOGE("%s: QCA_WLAN_VENDOR_ATTR_TDLS_MAC_ADDR Invalid mac addr lenght",
+ __FUNCTION__);
+ return WIFI_ERROR_INVALID_ARGS;
+ }
memcpy(addr,
(u8 *)nla_data(tb_vendor[QCA_WLAN_VENDOR_ATTR_TDLS_MAC_ADDR]),
- nla_len(tb_vendor[QCA_WLAN_VENDOR_ATTR_TDLS_MAC_ADDR]));
+ sizeof(mac_addr));
ALOGV(MAC_ADDR_STR, MAC_ADDR_ARRAY(addr));