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

@@ -45,11 +45,6 @@ json SettingsManager::GetSettings(std::string settings_key)
json result;
bool ui_settings_key = false;
/*-----------------------------------------------------*\
| Remove any excess null termination from settings key |
\*-----------------------------------------------------*/
settings_key = StringUtils::remove_null_terminating_chars(settings_key);
for(std::size_t settings_key_idx = 0; settings_key_idx < 7; settings_key_idx++)
{
if(settings_key == ui_settings_keys[settings_key_idx])
@@ -98,11 +93,6 @@ void SettingsManager::SetSettings(std::string settings_key, json new_settings)
{
bool ui_settings_key = false;
/*-----------------------------------------------------*\
| Remove any excess null termination from settings key |
\*-----------------------------------------------------*/
settings_key = StringUtils::remove_null_terminating_chars(settings_key);
for(std::size_t settings_key_idx = 0; settings_key_idx < 7; settings_key_idx++)
{
if(settings_key == ui_settings_keys[settings_key_idx])