From f63aec118c9154cf16e7f0170dc6f2567ae39943 Mon Sep 17 00:00:00 2001 From: Diogo Trindade Date: Wed, 10 Feb 2021 23:10:57 +0000 Subject: [PATCH] Fixed profile string sdk response not being null terminated --- ProfileManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ProfileManager.cpp b/ProfileManager.cpp index 45aeb908..780e330c 100644 --- a/ProfileManager.cpp +++ b/ProfileManager.cpp @@ -398,7 +398,7 @@ unsigned char * ProfileManager::GetProfileListDescription() for(unsigned int i = 0; i < num_profiles; i++) { data_size += sizeof (unsigned short); - data_size += strlen(profile_list[i].c_str()); + data_size += strlen(profile_list[i].c_str()) + 1; } /*---------------------------------------------------------*\ @@ -423,7 +423,7 @@ unsigned char * ProfileManager::GetProfileListDescription() \*---------------------------------------------------------*/ for(unsigned int i = 0; i < num_profiles; i++) { - unsigned short name_len = strlen(profile_list[i].c_str()); + unsigned short name_len = strlen(profile_list[i].c_str()) + 1; memcpy(&data_buf[data_ptr], &name_len, sizeof(name_len)); data_ptr += sizeof(name_len);