mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2025-08-02 03:34:26 +02:00
Fix crash when creating address from 17 char string.
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user