mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-11-24 22:20:55 +01:00
Fix crash when creating address from 17 char string.
This commit is contained in:
parent
d22db6ef8c
commit
12074d1cc4
1 changed files with 1 additions and 1 deletions
|
@ -54,7 +54,7 @@ NimBLEAddress::NimBLEAddress(const std::string& addr, uint8_t type) {
|
||||||
if (addr.length() == 17) {
|
if (addr.length() == 17) {
|
||||||
std::string mac{addr};
|
std::string mac{addr};
|
||||||
mac.erase(std::remove(mac.begin(), mac.end(), ':'), mac.end());
|
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);
|
memcpy(this->val, &address, sizeof this->val);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue