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
2026-01-23 11:46:39 -06:00
parent df67332a30
commit d8fb4897a1
5 changed files with 39 additions and 36 deletions

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 |
\*-----------------------------------------------------*/