summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackLivio <jack@livio.io>2019-04-04 14:05:04 -0400
committerGitHub <noreply@github.com>2019-04-04 14:05:04 -0400
commit53fc68a800da61123a1e5f34d17912e01630060c (patch)
tree41c15617478e779488036eb041c3e06bde0ea6a8
parentcd94140ec67f03e2aaeb1214ec21581a8fd1b622 (diff)
downloadsdl_core-53fc68a800da61123a1e5f34d17912e01630060c.tar.gz
Fix Icon Url Corner Cases (#2875)
* Add missing return * Check if correlation id < 1 for requests * Add clarifying comment
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc1
-rw-r--r--src/components/application_manager/src/rpc_handler_impl.cc21
2 files changed, 22 insertions, 0 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc
index da39aefd6a..ca9182469a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc
@@ -543,6 +543,7 @@ void SystemRequest::Run() {
if (file_name.empty()) {
const std::string err_msg = "Invalid file name";
SendResponse(false, mobile_apis::Result::INVALID_DATA, err_msg.c_str());
+ return;
}
LOG4CXX_DEBUG(logger_, "Got ICON_URL Request. File name: " << file_name);
} else {
diff --git a/src/components/application_manager/src/rpc_handler_impl.cc b/src/components/application_manager/src/rpc_handler_impl.cc
index 6205e028d0..156abfbed8 100644
--- a/src/components/application_manager/src/rpc_handler_impl.cc
+++ b/src/components/application_manager/src/rpc_handler_impl.cc
@@ -74,6 +74,27 @@ void RPCHandlerImpl::ProcessMessageFromMobile(
return;
}
+ if (message->type() == application_manager::MessageType::kRequest &&
+ message->correlation_id() < 0) {
+ LOG4CXX_ERROR(logger_, "Request correlation id < 0. Returning INVALID_ID");
+ std::shared_ptr<smart_objects::SmartObject> response(
+ MessageHelper::CreateNegativeResponse(message->connection_key(),
+ message->function_id(),
+ 0,
+ mobile_apis::Result::INVALID_ID));
+ // CreateNegativeResponse() takes a uint32_t for correlation_id, therefore a
+ // negative number cannot be passed to that function or else it will be
+ // improperly cast. correlation_id is reassigned below to its original
+ // value.
+ (*response)[strings::params][strings::correlation_id] =
+ message->correlation_id();
+ (*response)[strings::msg_params][strings::info] =
+ "Invalid Correlation ID for RPC Request";
+ app_manager_.GetRPCService().ManageMobileCommand(
+ response, commands::Command::SOURCE_SDL);
+ return;
+ }
+
bool rpc_passing = app_manager_.GetAppServiceManager()
.GetRPCPassingHandler()
.CanHandleFunctionID(message->function_id());