Skip to content

Commit 5bff89f

Browse files
william-ferguson-aume-no-dev
authored andcommitted
Fixed issue-3153 - Allocating enough memory to construct the entire UUID as a String. (#3297)
1 parent 9bbd720 commit 5bff89f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libraries/BLE/src/BLEUUID.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ std::string BLEUUID::toString() {
367367
//
368368
// UUID string format:
369369
// AABBCCDD-EEFF-GGHH-IIJJ-KKLLMMNNOOPP
370-
auto size = 35;
370+
auto size = 37; // 32 for UUID data, 4 for '-' delimiters and one for a terminator == 37 chars
371371
char *hex = (char *)malloc(size);
372372
snprintf(hex, size, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
373373
m_uuid.uuid.uuid128[15], m_uuid.uuid.uuid128[14],

0 commit comments

Comments
 (0)