Skip to content

Commit

Permalink
AP_HAL_ESP32: use correct unformatted system ID length
Browse files Browse the repository at this point in the history
Avoids stuffing uninitialized data into the ID.
  • Loading branch information
tpwrules committed Jul 14, 2024
1 parent 07493ed commit 7516c03
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions libraries/AP_HAL_ESP32/Util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,15 +243,13 @@ bool Util::get_system_id(char buf[50])

bool Util::get_system_id_unformatted(uint8_t buf[], uint8_t &len)
{
len = MIN(12, len);


uint8_t base_mac_addr[6] = {0};
esp_err_t ret = esp_efuse_mac_get_custom(base_mac_addr);
if (ret != ESP_OK) {
ret = esp_efuse_mac_get_default(base_mac_addr);
}

len = MIN(len, ARRAY_SIZE(base_mac_addr));
memcpy(buf, (const void *)base_mac_addr, len);

return true;
Expand Down

0 comments on commit 7516c03

Please sign in to comment.