Fixed issue-3153 - Allocating enough memory to construct the entire UUID as a String. (#3297)
This commit is contained in:
parent
9bbd720d4c
commit
5bff89f0be
@ -367,7 +367,7 @@ std::string BLEUUID::toString() {
|
|||||||
//
|
//
|
||||||
// UUID string format:
|
// UUID string format:
|
||||||
// AABBCCDD-EEFF-GGHH-IIJJ-KKLLMMNNOOPP
|
// AABBCCDD-EEFF-GGHH-IIJJ-KKLLMMNNOOPP
|
||||||
auto size = 35;
|
auto size = 37; // 32 for UUID data, 4 for '-' delimiters and one for a terminator == 37 chars
|
||||||
char *hex = (char *)malloc(size);
|
char *hex = (char *)malloc(size);
|
||||||
snprintf(hex, size, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
snprintf(hex, size, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
||||||
m_uuid.uuid.uuid128[15], m_uuid.uuid.uuid128[14],
|
m_uuid.uuid.uuid128[15], m_uuid.uuid.uuid128[14],
|
||||||
|
Loading…
Reference in New Issue
Block a user