diff options
author | jacobkeeler <jacob.keeler@livioradio.com> | 2017-09-20 16:06:37 -0400 |
---|---|---|
committer | jacobkeeler <jacob.keeler@livioradio.com> | 2017-09-21 11:18:46 -0400 |
commit | a3119c09b52b359fc745bd18b4ea10a653244a38 (patch) | |
tree | 51d850c74fe6e0221a42336c17b237ee583541b0 | |
parent | 2bc4f8b8b59c74c81abe481256b1fa331114909e (diff) | |
download | sdl_core-a3119c09b52b359fc745bd18b4ea10a653244a38.tar.gz |
Fix coverity issues related to protocol changes
Fixes CIDs 174942, 174939, 174936, 174936
3 files changed, 8 insertions, 7 deletions
diff --git a/src/components/protocol_handler/include/protocol_handler/protocol_packet.h b/src/components/protocol_handler/include/protocol_handler/protocol_packet.h index 31b4c12ea6..4d9b6e462c 100644 --- a/src/components/protocol_handler/include/protocol_handler/protocol_packet.h +++ b/src/components/protocol_handler/include/protocol_handler/protocol_packet.h @@ -79,13 +79,13 @@ class ProtocolPacket { uint8_t majorVersion; uint8_t minorVersion; uint8_t patchVersion; - static inline uint8_t cmp(const ProtocolVersion& version1, + static inline int16_t cmp(const ProtocolVersion& version1, const ProtocolVersion& version2) { - uint8_t diff = version1.majorVersion - version2.majorVersion; + int16_t diff = static_cast<int16_t>(version1.majorVersion - version2.majorVersion); if (diff == 0) { - diff = version1.minorVersion - version2.minorVersion; + diff = static_cast<int16_t>(version1.minorVersion - version2.minorVersion); if (diff == 0) { - diff = version1.minorVersion - version2.minorVersion; + diff = static_cast<int16_t>(version1.patchVersion - version2.patchVersion); } } return diff; diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc index ec4663764a..7f30017856 100644 --- a/src/components/protocol_handler/src/protocol_handler_impl.cc +++ b/src/components/protocol_handler/src/protocol_handler_impl.cc @@ -294,7 +294,7 @@ void ProtocolHandlerImpl::SendStartSessionAck( ? &defaultProtocolVersion : ProtocolPacket::ProtocolVersion::min(full_version, defaultProtocolVersion); - char protocolVersionString[255]; + char protocolVersionString[256]; strncpy(protocolVersionString, (*minVersion).to_string().c_str(), 255); bson_object_put_string( ¶ms, strings::protocol_version, protocolVersionString); @@ -1214,7 +1214,8 @@ class StartSessionHandler : public security_manager::SecurityManagerListener { , hash_id_(hash_id) , service_type_(service_type) , force_protected_service_(force_protected_service) - , full_version_() {} + , full_version_() + , payload_(NULL) {} StartSessionHandler(uint32_t connection_key, ProtocolHandlerImpl* protocol_handler, SessionObserver& session_observer, diff --git a/src/components/protocol_handler/src/protocol_packet.cc b/src/components/protocol_handler/src/protocol_packet.cc index 39871d5bae..ae52849de6 100644 --- a/src/components/protocol_handler/src/protocol_packet.cc +++ b/src/components/protocol_handler/src/protocol_packet.cc @@ -84,7 +84,7 @@ ProtocolPacket::ProtocolVersion::ProtocolVersion(std::string versionString) } std::string ProtocolPacket::ProtocolVersion::to_string() { - char versionString[255]; + char versionString[256]; snprintf(versionString, 255, "%u.%u.%u", |