Fix crash when creating address from 17 char string.

This commit is contained in:
h2zero 2024-08-12 07:56:38 -06:00
parent d22db6ef8c
commit 12074d1cc4

View file

@ -54,7 +54,7 @@ NimBLEAddress::NimBLEAddress(const std::string& addr, uint8_t type) {
if (addr.length() == 17) {
std::string mac{addr};
mac.erase(std::remove(mac.begin(), mac.end(), ':'), mac.end());
uint64_t address = std::stoul(mac, nullptr, 16);
uint64_t address = std::stoull(mac, nullptr, 16);
memcpy(this->val, &address, sizeof this->val);
return;
}