Use std::string.assign when setting strings in the SDK protocol and description handlers so that string size limit is enforced, then strip out null terminators

This commit is contained in:
Adam Honse committed 2026-05-07 17:24:45 -05:00
1 parent 5133887632
commit 4e70949aec
5 files changed
+39 -36

No files matched your search

-15
View File
@@ -97,11 +97,6 @@ ProfileManager::~ProfileManager()
void ProfileManager::DeleteProfile(std::string profile_name)
{
/*-----------------------------------------------------*\
| Clean up the profile name |
\*-----------------------------------------------------*/
profile_name = StringUtils::remove_null_terminating_chars(profile_name);
if(ResourceManager::get()->IsLocalClient() && (ResourceManager::get()->GetLocalClientProtocolVersion() >= 6))
{
ResourceManager::get()->GetLocalClient()->ProfileManager_DeleteProfile(profile_name);
@@ -242,11 +237,6 @@ nlohmann::json ProfileManager::ReadProfileJSON(std::string profile_name)
{
nlohmann::json profile_json;
/*-----------------------------------------------------*\
| Clean up the profile name |
\*-----------------------------------------------------*/
profile_name = StringUtils::remove_null_terminating_chars(profile_name);
if(ResourceManager::get()->IsLocalClient() && (ResourceManager::get()->GetLocalClientProtocolVersion() >= 6))
{
profile_json = nlohmann::json::parse(ResourceManager::get()->GetLocalClient()->ProfileManager_DownloadProfile(profile_name));
@@ -271,11 +261,6 @@ nlohmann::json ProfileManager::ReadProfileJSON(std::string profile_name)
bool ProfileManager::SaveProfile(std::string profile_name)
{
/*-----------------------------------------------------*\
| Clean up the profile name |
\*-----------------------------------------------------*/
profile_name = StringUtils::remove_null_terminating_chars(profile_name);
/*-----------------------------------------------------*\
| If a name was entered, save the profile file |
\*-----------------------------------------------------*/