summaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
authorShobhit Adlakha <ShobhitAd@users.noreply.github.com>2022-05-27 10:15:34 -0400
committerGitHub <noreply@github.com>2022-05-27 10:15:34 -0400
commit2fa821028d2457a4e9d62381edb635769b8bf704 (patch)
tree78b378a3386dd0f8979b82bb99ee30654c99f204 /src/components
parent65947fd1eb30a392948d67003df0fe803c070c6b (diff)
downloadsdl_core-2fa821028d2457a4e9d62381edb635769b8bf704.tar.gz
Fix/Adjust PTS content length for newline string (#3913)
* Add check for newline string and adjust content length for added escape character * Apply same fix to sample_policy_manager for extern proprietary * Address review comments
Diffstat (limited to 'src/components')
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc
index af0a5a6539..0537043cd4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc
@@ -225,8 +225,13 @@ size_t OnSystemRequestNotification::ParsePTString(
size_t result_length = length;
result.reserve(length * 2);
for (size_t i = 0; i < length; ++i) {
- if (pt_string[i] == '\"' || pt_string[i] == '\\') {
+ if (pt_string[i] == '\"') {
result += '\\';
+ } else if (pt_string[i] == '\\') {
+ result += '\\';
+ --result_length; // contentLength is adjusted for the additional escape
+ // character added before special characters (like the
+ // newline string)
} else if (pt_string[i] == '\n') {
--result_length; // contentLength is adjusted when this character is
// not copied to result.