wifi: Prevent returning an invalid factory MAC address

This is the same error checking already done in wifi_ap_iface.cpp

Change-Id: I2183e6ec13a15141dc638dc8d68fda6b3afa5aa4
This commit is contained in:
Alessandro Astone 2020-11-11 18:41:30 +01:00
parent 7bfe3131a6
commit 40e57ca717

View file

@ -636,6 +636,10 @@ std::pair<WifiStatus, std::array<uint8_t, 6>>
WifiStaIface::getFactoryMacAddressInternal() { WifiStaIface::getFactoryMacAddressInternal() {
std::array<uint8_t, 6> mac = std::array<uint8_t, 6> mac =
iface_util_.lock()->getFactoryMacAddress(ifname_); iface_util_.lock()->getFactoryMacAddress(ifname_);
if (mac[0] == 0 && mac[1] == 0 && mac[2] == 0 && mac[3] == 0 &&
mac[4] == 0 && mac[5] == 0) {
return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), mac};
}
return {createWifiStatus(WifiStatusCode::SUCCESS), mac}; return {createWifiStatus(WifiStatusCode::SUCCESS), mac};
} }