FIX: getEfuseMac can return random data (#1059)

esp_efuse_mac_get_default() only stores into the bottom 6 bytes of it's 8-byte argument, so must initialize this arg to zero to avoid trash on the stack.
This commit is contained in:
Tom Ferrin 2018-03-04 11:35:14 -08:00 committed by Me No Dev
parent 8e29347d4f
commit da46d0b264

View File

@ -218,7 +218,7 @@ bool EspClass::flashRead(uint32_t offset, uint32_t *data, size_t size)
uint64_t EspClass::getEfuseMac(void) uint64_t EspClass::getEfuseMac(void)
{ {
uint64_t _chipmacid; uint64_t _chipmacid = 0LL;
esp_efuse_mac_get_default((uint8_t*) (&_chipmacid)); esp_efuse_mac_get_default((uint8_t*) (&_chipmacid));
return _chipmacid; return _chipmacid;
} }