Skip to content

Commit da46d0b

Browse files
tferrinme-no-dev
authored andcommitted
FIX: getEfuseMac can return random data (espressif#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.
1 parent 8e29347 commit da46d0b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cores/esp32/Esp.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ bool EspClass::flashRead(uint32_t offset, uint32_t *data, size_t size)
218218

219219
uint64_t EspClass::getEfuseMac(void)
220220
{
221-
uint64_t _chipmacid;
221+
uint64_t _chipmacid = 0LL;
222222
esp_efuse_mac_get_default((uint8_t*) (&_chipmacid));
223223
return _chipmacid;
224224
}

0 commit comments

Comments
 (0)