From da46d0b2642fd692292b12be9a3ec2b54088ffc1 Mon Sep 17 00:00:00 2001 From: Tom Ferrin Date: Sun, 4 Mar 2018 11:35:14 -0800 Subject: [PATCH] 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. --- cores/esp32/Esp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cores/esp32/Esp.cpp b/cores/esp32/Esp.cpp index c60abfbb..d9f1da0c 100644 --- a/cores/esp32/Esp.cpp +++ b/cores/esp32/Esp.cpp @@ -218,7 +218,7 @@ bool EspClass::flashRead(uint32_t offset, uint32_t *data, size_t size) uint64_t EspClass::getEfuseMac(void) { - uint64_t _chipmacid; + uint64_t _chipmacid = 0LL; esp_efuse_mac_get_default((uint8_t*) (&_chipmacid)); return _chipmacid; }