mirror of
https://github.com/esphome/esphome.git
synced 2026-10-01 00:40:21 +00:00
[esp32] Validate eFuse MAC reads and reject garbage MACs (#15049)
This commit is contained in:
@@ -863,7 +863,16 @@ bool mac_address_is_valid(const uint8_t *mac) {
|
||||
is_all_ones = false;
|
||||
}
|
||||
}
|
||||
return !(is_all_zeros || is_all_ones);
|
||||
if (is_all_zeros || is_all_ones) {
|
||||
return false;
|
||||
}
|
||||
// Reject multicast MACs (bit 0 of first byte set) - device MACs must be unicast.
|
||||
// This catches garbage data from corrupted eFuse custom MAC areas, which often
|
||||
// has random values that would otherwise pass the all-zeros/all-ones check.
|
||||
if (mac[0] & 0x01) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void IRAM_ATTR HOT delay_microseconds_safe(uint32_t us) {
|
||||
|
||||
Reference in New Issue
Block a user