From 5bff89f0be51da3a6306a342e75517f861ba61c9 Mon Sep 17 00:00:00 2001 From: William Ferguson Date: Mon, 30 Sep 2019 06:03:48 +1000 Subject: [PATCH] Fixed issue-3153 - Allocating enough memory to construct the entire UUID as a String. (#3297) --- libraries/BLE/src/BLEUUID.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/BLE/src/BLEUUID.cpp b/libraries/BLE/src/BLEUUID.cpp index a1ec2148..4de75a38 100644 --- a/libraries/BLE/src/BLEUUID.cpp +++ b/libraries/BLE/src/BLEUUID.cpp @@ -367,7 +367,7 @@ std::string BLEUUID::toString() { // // UUID string format: // 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); 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],