Commit 5bff89f0 authored by William Ferguson's avatar William Ferguson Committed by Me No Dev

Fixed issue-3153 - Allocating enough memory to construct the entire UUID as a String. (#3297)

parent 9bbd720d
...@@ -367,7 +367,7 @@ std::string BLEUUID::toString() { ...@@ -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],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment