From 8fc412ce374d33e0e8de2f54eb791b8e62369fe8 Mon Sep 17 00:00:00 2001 From: melhar098 Date: Thu, 15 Feb 2024 13:36:42 -0500 Subject: [PATCH 1/2] RDK-45343: [Coverity][SECVULN] Various issues in rdkservices-Phase 2 Reason for change: Fix security vulnerabilities Test Procedure: Check for regressions Risks: Low Priority: P1 Signed-off-by: melhar098 --- AVInput/AVInput.cpp | 4 +-- Bluetooth/Bluetooth.cpp | 8 +++--- ContinueWatching/ContinueWatching.cpp | 28 ++++++++++++++++--- ControlService/ControlService.cpp | 27 +++++++++--------- ControlService/test/controlSvcTestClient.cpp | 1 - DataCapture/DataCapture.cpp | 19 ++++++++++--- DeviceDiagnostics/DeviceDiagnostics.cpp | 21 +++++++++----- .../DeviceSettings/PlatformImplementation.cpp | 2 +- DisplayInfo/DisplayInfo.h | 1 + DisplaySettings/DisplaySettings.cpp | 3 ++ FrontPanel/FrontPanel.cpp | 3 +- FrontPanel/FrontPanel.h | 2 +- HdcpProfile/HdcpProfile.cpp | 6 +++- HdmiInput/HdmiInput.cpp | 2 +- LocationSync/LocationService.cpp | 1 + Monitor/Monitor.h | 4 +-- Network/NetUtils.cpp | 4 ++- Network/NetUtilsNetlink.cpp | 4 +++ Network/Network.cpp | 2 ++ OpenCDMi/FrameworkRPC.cpp | 11 ++++++-- OpenCDMi/OCDM.cpp | 4 +-- OpenCDMi/OCDM.h | 3 +- Packager/PackagerImplementation.cpp | 6 ++-- PlayerInfo/PlayerInfo.h | 2 ++ RemoteActionMapping/RamHelper.cpp | 6 +--- SystemServices/cTimer.h | 2 +- .../platformcaps/platformcapsdata.cpp | 2 +- TextToSpeech/impl/logger.cpp | 3 +- helpers/frontpanel.h | 4 +++ 29 files changed, 125 insertions(+), 60 deletions(-) diff --git a/AVInput/AVInput.cpp b/AVInput/AVInput.cpp index dbfb930963..c6e379dbfb 100644 --- a/AVInput/AVInput.cpp +++ b/AVInput/AVInput.cpp @@ -925,7 +925,7 @@ void AVInput::dsAVVideoModeEventHandler(const char *owner, IARM_EventId_t eventI if (IARM_BUS_DSMGR_EVENT_HDMI_IN_VIDEO_MODE_UPDATE == eventId) { IARM_Bus_DSMgr_EventData_t *eventData = (IARM_Bus_DSMgr_EventData_t *)data; int hdmi_in_port = eventData->data.hdmi_in_video_mode.port; - dsVideoPortResolution_t resolution; + dsVideoPortResolution_t resolution = {}; resolution.pixelResolution = eventData->data.hdmi_in_video_mode.resolution.pixelResolution; resolution.interlaced = eventData->data.hdmi_in_video_mode.resolution.interlaced; resolution.frameRate = eventData->data.hdmi_in_video_mode.resolution.frameRate; @@ -1161,7 +1161,7 @@ std::string AVInput::getSPD(int iPort) memcpy(&pre,spdVect.data(),sizeof(struct dsSpd_infoframe_st)); char str[200] = {0}; - sprintf(str, "Packet Type:%02X,Version:%u,Length:%u,vendor name:%s,product des:%s,source info:%02X", + snprintf(str, sizeof(str), "Packet Type:%02X,Version:%u,Length:%u,vendor name:%s,product des:%s,source info:%02X", pre.pkttype,pre.version,pre.length,pre.vendor_name,pre.product_des,pre.source_info); spdbase64 = str; } diff --git a/Bluetooth/Bluetooth.cpp b/Bluetooth/Bluetooth.cpp index 5deffc4444..3e7b2611b1 100644 --- a/Bluetooth/Bluetooth.cpp +++ b/Bluetooth/Bluetooth.cpp @@ -143,7 +143,7 @@ namespace WPEFramework Bluetooth* Bluetooth::_instance = nullptr; static Core::TimerType _discoveryTimer(64 * 1024, "DiscoveryTimer"); - BTRMGR_Result_t bluetoothSrv_EventCallback (BTRMGR_EventMessage_t eventMsg) + BTRMGR_Result_t bluetoothSrv_EventCallback (BTRMGR_EventMessage_t &eventMsg) { if (!Bluetooth::_instance) { LOGERR ("Invalid pointer. Bluetooth is not initialized (yet?). Event of type %d ignored.", eventMsg.m_eventType); @@ -414,7 +414,7 @@ namespace WPEFramework JsonArray Bluetooth::getPairedDevices() { JsonArray deviceArray; - BTRMGR_PairedDevicesList_t pairedDevices; + BTRMGR_PairedDevicesList_t *pairedDevices = (BTRMGR_PairedDevicesList_t)malloc(sizeof(BTRMGR_PairedDevicesList_t)); memset (&pairedDevices, 0, sizeof(pairedDevices)); BTRMGR_Result_t rc = BTRMGR_GetPairedDevices(0, &pairedDevices); @@ -442,7 +442,7 @@ namespace WPEFramework JsonArray Bluetooth::getConnectedDevices() { JsonArray deviceArray; - BTRMGR_ConnectedDevicesList_t connectedDevices; + BTRMGR_ConnectedDevicesList_t *connectedDevices = (BTRMGR_ConnectedDevicesList_t)malloc(sizeof(BTRMGR_ConnectedDevicesList_t)); memset (&connectedDevices, 0, sizeof(connectedDevices)); BTRMGR_Result_t rc = BTRMGR_GetConnectedDevices(0, &connectedDevices); @@ -862,7 +862,7 @@ namespace WPEFramework return mediaTrackInfo; } - void Bluetooth::notifyEventWrapper (BTRMGR_EventMessage_t eventMsg) + void Bluetooth::notifyEventWrapper (BTRMGR_EventMessage_t &eventMsg) { JsonObject params; string profileInfo; diff --git a/ContinueWatching/ContinueWatching.cpp b/ContinueWatching/ContinueWatching.cpp index 46d10b7278..9e54c86cbc 100644 --- a/ContinueWatching/ContinueWatching.cpp +++ b/ContinueWatching/ContinueWatching.cpp @@ -295,6 +295,7 @@ namespace WPEFramework { * @return None. */ ContinueWatchingImpl::ContinueWatchingImpl() + : mSecObjectId(0) { } @@ -539,6 +540,7 @@ namespace WPEFramework { char *jsonOut = NULL; cJSON *root = NULL; bool createNewJsonDoc = true; + size_t check_ret = 0; FILE *file = fopen(CW_LOCAL_FILE, "r"); if (file) { @@ -551,7 +553,11 @@ namespace WPEFramework { } fseek(file, 0, SEEK_SET); - fread(jsonDoc, numbytes, 1, file); + if(numbytes >= 0) { + check_ret = fread(jsonDoc, numbytes, 1, file); + if(check_ret != 1) + LOGWARN("Failed to read from file: %s", file); + } fclose(file); file = NULL; jsonDoc[numbytes] = 0; @@ -633,6 +639,7 @@ namespace WPEFramework { char *jsonDoc = NULL; std::string retVal = ""; FILE *file = fopen(CW_LOCAL_FILE, "r"); + size_t check_ret = 0; if (!file) return retVal; @@ -646,7 +653,11 @@ namespace WPEFramework { } fseek(file, 0, SEEK_SET); - fread(jsonDoc, 1, numbytes, file); + if(numbytes >= 0) { + check_ret = fread(jsonDoc, numbytes, 1, file); + if(check_ret != 1) + LOGWARN("Failed to read from file: %s", file); + } fclose(file); jsonDoc[numbytes] = '\0'; @@ -687,6 +698,7 @@ namespace WPEFramework { char *jsonOut = NULL; cJSON *root = NULL; bool retVal = false; + size_t check_ret = 0; if(!tr181FeatureEnabled()) { LOGWARN("Feature DISABLED...\n"); @@ -705,7 +717,11 @@ namespace WPEFramework { return false; } fseek(file, 0, SEEK_SET); - fread(jsonDoc, numbytes, 1, file); + if(numbytes >= 0) { + check_ret = fread(jsonDoc, numbytes, 1, file); + if(check_ret != 1) + LOGWARN("Failed to read from file: %s", file); + } fclose(file); file = NULL; jsonDoc[numbytes] = 0; @@ -761,10 +777,14 @@ namespace WPEFramework { */ std::string ContinueWatchingImpl::sha256(const std::string str) { + int check_update = 0; unsigned char hash[SHA256_DIGEST_LENGTH]; SHA256_CTX sha256Ctx; SHA256_Init(&sha256Ctx); - SHA256_Update(&sha256Ctx, str.c_str(), str.size()); + check_update = SHA256_Update(&sha256Ctx, str.c_str(), str.size()); + if(check_update == 0){ + LOGWARN("Failed hash update"); + } SHA256_Final(hash, &sha256Ctx); std::stringstream strStream; /* Iterate through hash & convert each byte to 2-char wide hex */ diff --git a/ControlService/ControlService.cpp b/ControlService/ControlService.cpp index 0aba60b6c2..4743f19f42 100644 --- a/ControlService/ControlService.cpp +++ b/ControlService/ControlService.cpp @@ -84,6 +84,7 @@ namespace WPEFramework { ControlService::ControlService() : PluginHost::JSONRPC() + , m_numOfBindRemotes(0) , m_apiVersionNumber((uint32_t)-1) /* default max uint32_t so everything gets enabled */ //TODO(MROLLINS) Can't we access this from jsonrpc interface? { LOGINFO("ctor"); @@ -228,11 +229,11 @@ namespace WPEFramework { } } - void ControlService::irmgrHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len) + void ControlService::irmgrHandler(const char *owner, IARM_EventId_t eventId, void *dataP, size_t len) { if (eventId == IARM_BUS_IRMGR_EVENT_IRKEY) { - IARM_Bus_IRMgr_EventData_t *irEventData = (IARM_Bus_IRMgr_EventData_t*)data; + IARM_Bus_IRMgr_EventData_t *irEventData = (IARM_Bus_IRMgr_EventData_t*)dataP; int keyCode = irEventData->data.irkey.keyCode; int keySrc = irEventData->data.irkey.keySrc; int keyType = irEventData->data.irkey.keyType; @@ -269,14 +270,14 @@ namespace WPEFramework { } } - void ControlService::ctrlmHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len) + void ControlService::ctrlmHandler(const char *owner, IARM_EventId_t eventId, void *dataP, size_t len) { if (eventId == CTRLM_RCU_IARM_EVENT_KEY_GHOST) { LOGINFO("Got a controlMgr ghost key event!"); - if (data != NULL) + if (dataP != NULL) { - ctrlm_rcu_iarm_event_key_ghost_t *msg = (ctrlm_rcu_iarm_event_key_ghost_t*)data; + ctrlm_rcu_iarm_event_key_ghost_t *msg = (ctrlm_rcu_iarm_event_key_ghost_t*)dataP; int remoteId = msg->controller_id; int ghostCode = msg->ghost_code; @@ -332,9 +333,9 @@ namespace WPEFramework { len, sizeof(ctrlm_rcu_iarm_event_battery_t)); return; } - if (data != NULL) + if (dataP != NULL) { - ctrlm_rcu_iarm_event_battery_t *msg = (ctrlm_rcu_iarm_event_battery_t*)data; + ctrlm_rcu_iarm_event_battery_t *msg = (ctrlm_rcu_iarm_event_battery_t*)dataP; if (msg->api_revision == CTRLM_RCU_IARM_BUS_API_REVISION) { int remoteId = msg->controller_id; @@ -370,9 +371,9 @@ namespace WPEFramework { len, sizeof(ctrlm_rcu_iarm_event_remote_reboot_t)); return; } - if (data != NULL) + if (dataP != NULL) { - ctrlm_rcu_iarm_event_remote_reboot_t *msg = (ctrlm_rcu_iarm_event_remote_reboot_t*)data; + ctrlm_rcu_iarm_event_remote_reboot_t *msg = (ctrlm_rcu_iarm_event_remote_reboot_t*)dataP; if (msg->api_revision == CTRLM_RCU_IARM_BUS_API_REVISION) { int remoteId = msg->controller_id; @@ -413,9 +414,9 @@ namespace WPEFramework { len, sizeof(ctrlm_rcu_iarm_event_reverse_cmd_t)); return; } - if (data != NULL) + if (dataP != NULL) { - ctrlm_rcu_iarm_event_reverse_cmd_t *msg = (ctrlm_rcu_iarm_event_reverse_cmd_t*)data; + ctrlm_rcu_iarm_event_reverse_cmd_t *msg = (ctrlm_rcu_iarm_event_reverse_cmd_t*)dataP; if (msg->api_revision == CTRLM_RCU_IARM_BUS_API_REVISION) { ctrlm_rcu_reverse_cmd_t cmd = msg->action; @@ -463,9 +464,9 @@ namespace WPEFramework { else if (eventId == CTRLM_RCU_IARM_EVENT_CONTROL) { LOGINFO("Got a controlMgr control event!"); - if (data != NULL) + if (dataP != NULL) { - ctrlm_rcu_iarm_event_control_t *msg = (ctrlm_rcu_iarm_event_control_t*)data; + ctrlm_rcu_iarm_event_control_t *msg = (ctrlm_rcu_iarm_event_control_t*)dataP; int remoteId = msg->controller_id; int value = msg->event_value; int spare_value = msg->spare_value; diff --git a/ControlService/test/controlSvcTestClient.cpp b/ControlService/test/controlSvcTestClient.cpp index 5a020994c0..ce01309918 100644 --- a/ControlService/test/controlSvcTestClient.cpp +++ b/ControlService/test/controlSvcTestClient.cpp @@ -843,7 +843,6 @@ int main(int argc, char** argv) cmd = lastCmd; else if ((cmd[0] >= '0') && (cmd[0] <= '9')) { - choice = stoi(cmd); remoteId = 255; timeOutPeriod = 0; pairingMode = 255; diff --git a/DataCapture/DataCapture.cpp b/DataCapture/DataCapture.cpp index dc9e42e334..597f4e146f 100644 --- a/DataCapture/DataCapture.cpp +++ b/DataCapture/DataCapture.cpp @@ -103,6 +103,12 @@ namespace WPEFramework { Register(METHOD_ENABLE_AUDIO_CAPTURE, &DataCapture::enableAudioCaptureWrapper, this); Register(METHOD_GET_AUDIO_CLIP, &DataCapture::getAudioClipWrapper, this); + _audio_properties.format = acmFormate16BitStereo; + _audio_properties.sampling_frequency = acmFreqe16000; + _audio_properties.fifo_size = 0; + _audio_properties.threshold = 0; + _audio_properties.delay_compensation_ms = 0; + _sock_adaptor.reset(new socket_adaptor()); } @@ -513,10 +519,15 @@ namespace WPEFramework { chunk = curl_slist_append(chunk, "Content-Type: audio/x-wav"); //set url and data - curl_easy_setopt(curl, CURLOPT_URL, url); - curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk); - curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, data.size()); - curl_easy_setopt(curl, CURLOPT_POSTFIELDS, &data[0]); + if(curl_easy_setopt(curl, CURLOPT_URL, url) != CURLE_OK) + LOGWARN("Failed to set curl option: CURLOPT_URL"); + if(curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk) != CURLE_OK) + LOGWARN("Failed to set curl option: CURLOPT_HTTPHEADER"); + if(curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, data.size()) != CURLE_OK) + LOGWARN("Failed to set curl option: CURLOPT_POSTFIELDSIZE"); + if(curl_easy_setopt(curl, CURLOPT_POSTFIELDS, &data[0]) != CURLE_OK) + LOGWARN("Failed to set curl option: CURLOPT_POSTFIELDS"); + //perform blocking upload call res = curl_easy_perform(curl); diff --git a/DeviceDiagnostics/DeviceDiagnostics.cpp b/DeviceDiagnostics/DeviceDiagnostics.cpp index 2b87871722..ff66584efd 100644 --- a/DeviceDiagnostics/DeviceDiagnostics.cpp +++ b/DeviceDiagnostics/DeviceDiagnostics.cpp @@ -289,13 +289,20 @@ namespace WPEFramework if (curl_handle) { - curl_easy_setopt(curl_handle, CURLOPT_URL, "http://127.0.0.1:10999"); - curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, postData.c_str()); - curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDSIZE, postData.size()); - curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1); //when redirected, follow the redirections - curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, writeCurlResponse); - curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, &response); - curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, curlTimeoutInSeconds); + if(curl_easy_setopt(curl_handle, CURLOPT_URL, "http://127.0.0.1:10999") != CURLE_OK) + LOGWARN("Failed to set curl option: CURLOPT_URL"); + if(curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, postData.c_str()) != CURLE_OK) + LOGWARN("Failed to set curl option: CURLOPT_POSTFIELDS"); + if(curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDSIZE, postData.size()) != CURLE_OK) + LOGWARN("Failed to set curl option: CURLOPT_POSTFIELDSIZE"); + if(curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1) != CURLE_OK) //when redirected, follow the redirections + LOGWARN("Failed to set curl option: CURLOPT_FOLLOWLOCATION"); + if(curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, writeCurlResponse) != CURLE_OK) + LOGWARN("Failed to set curl option: CURLOPT_WRITEFUNCTION"); + if(curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, &response) != CURLE_OK) + LOGWARN("Failed to set curl option: CURLOPT_WRITEDATA"); + if(curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, curlTimeoutInSeconds) != CURLE_OK) + LOGWARN("Failed to set curl option: CURLOPT_TIMEOUT"); res = curl_easy_perform(curl_handle); curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &http_code); diff --git a/DisplayInfo/DeviceSettings/PlatformImplementation.cpp b/DisplayInfo/DeviceSettings/PlatformImplementation.cpp index e2fd03ccb6..47f90f9b18 100644 --- a/DisplayInfo/DeviceSettings/PlatformImplementation.cpp +++ b/DisplayInfo/DeviceSettings/PlatformImplementation.cpp @@ -123,8 +123,8 @@ class DisplayInfoImplementation : ASSERT(index != _observers.end()); if (index != _observers.end()) { - (*index)->Release(); _observers.erase(index); + (*index)->Release(); } _adminLock.Unlock(); diff --git a/DisplayInfo/DisplayInfo.h b/DisplayInfo/DisplayInfo.h index 4c24e3cf90..4445765bbb 100644 --- a/DisplayInfo/DisplayInfo.h +++ b/DisplayInfo/DisplayInfo.h @@ -40,6 +40,7 @@ namespace Plugin { public: explicit Notification(DisplayInfo* parent) : _parent(*parent) + , _client(nullptr) { ASSERT(parent != nullptr); } diff --git a/DisplaySettings/DisplaySettings.cpp b/DisplaySettings/DisplaySettings.cpp index 17a3e9df38..d6df6f609a 100644 --- a/DisplaySettings/DisplaySettings.cpp +++ b/DisplaySettings/DisplaySettings.cpp @@ -2035,6 +2035,7 @@ namespace WPEFramework { IARM_Bus_PWRMgr_StandbyVideoState_Param_t param; param.isEnabled = enabled; strncpy(param.port, portname.c_str(), PWRMGR_MAX_VIDEO_PORT_NAME_LENGTH); + param.port[sizeof(param.port) - 1] = '\0'; if(IARM_RESULT_SUCCESS != IARM_Bus_Call(IARM_BUS_PWRMGR_NAME, IARM_BUS_PWRMGR_API_SetStandbyVideoState, ¶m, sizeof(param))) { LOGERR("Port: %s. enable: %d", param.port, param.isEnabled); @@ -2053,6 +2054,7 @@ namespace WPEFramework { dsMgrStandbyVideoStateParam_t param; param.isEnabled = enabled; strncpy(param.port, portname.c_str(), PWRMGR_MAX_VIDEO_PORT_NAME_LENGTH); + param.port[sizeof(param.port) - 1] = '\0'; if(IARM_RESULT_SUCCESS != IARM_Bus_Call(IARM_BUS_DSMGR_NAME, IARM_BUS_DSMGR_API_SetStandbyVideoState, ¶m, sizeof(param))) { LOGERR("Port: %s. enable: %d", param.port, param.isEnabled); @@ -4846,6 +4848,7 @@ void DisplaySettings::sendMsgThread() LOGINFO(" Send request for ARC TERMINATION"); result = DisplaySettings::_instance->setUpHdmiCecSinkArcRouting(false); } + break; default: { diff --git a/FrontPanel/FrontPanel.cpp b/FrontPanel/FrontPanel.cpp index c122a3f5fb..34612a74b8 100644 --- a/FrontPanel/FrontPanel.cpp +++ b/FrontPanel/FrontPanel.cpp @@ -179,6 +179,7 @@ namespace WPEFramework , m_updateTimer(this) { FrontPanel::_instance = this; + m_runUpdateTimer = false; Register(METHOD_FP_SET_BRIGHTNESS, &FrontPanel::setBrightnessWrapper, this); Register(METHOD_FP_GET_BRIGHTNESS, &FrontPanel::getBrightnessWrapper, this); @@ -244,7 +245,7 @@ namespace WPEFramework } } - const void FrontPanel::InitializeIARM() + void FrontPanel::InitializeIARM() { if (Utils::IARM::init()) { diff --git a/FrontPanel/FrontPanel.h b/FrontPanel/FrontPanel.h index 8d3eeb92d7..fdcd279c76 100644 --- a/FrontPanel/FrontPanel.h +++ b/FrontPanel/FrontPanel.h @@ -135,7 +135,7 @@ namespace WPEFramework { INTERFACE_ENTRY(PluginHost::IDispatcher) END_INTERFACE_MAP private: - const void InitializeIARM(); + void InitializeIARM(); void DeinitializeIARM(); static void powerModeChange(const char *owner, IARM_EventId_t eventId, void *data, size_t len); public: diff --git a/HdcpProfile/HdcpProfile.cpp b/HdcpProfile/HdcpProfile.cpp index 0686c17039..14740350a8 100644 --- a/HdcpProfile/HdcpProfile.cpp +++ b/HdcpProfile/HdcpProfile.cpp @@ -278,6 +278,8 @@ namespace WPEFramework void HdcpProfile::dsHdmiEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len) { + IARM_Result_t check_ret; + if(!HdcpProfile::_instance) return; @@ -292,7 +294,9 @@ namespace WPEFramework else if (IARM_BUS_DSMGR_EVENT_HDCP_STATUS == eventId) { IARM_Bus_PWRMgr_GetPowerState_Param_t param; - IARM_Bus_Call(IARM_BUS_PWRMGR_NAME, IARM_BUS_PWRMGR_API_GetPowerState, (void *)¶m, sizeof(param)); + check_ret = IARM_Bus_Call(IARM_BUS_PWRMGR_NAME, IARM_BUS_PWRMGR_API_GetPowerState, (void *)¶m, sizeof(param)); + if(check_ret != IARM_RESULT_SUCCESS) + LOGWARN("Failed to Invoke RPC method: GetPowerState"); IARM_Bus_DSMgr_EventData_t *eventData = (IARM_Bus_DSMgr_EventData_t *)data; int hdcpStatus = eventData->data.hdmi_hdcp.hdcpStatus; LOGINFO("Received IARM_BUS_DSMGR_EVENT_HDCP_STATUS event data:%d param.curState: %d \r\n", hdcpStatus,param.curState); diff --git a/HdmiInput/HdmiInput.cpp b/HdmiInput/HdmiInput.cpp index 7a20ae243a..409dc2f5c9 100644 --- a/HdmiInput/HdmiInput.cpp +++ b/HdmiInput/HdmiInput.cpp @@ -821,7 +821,7 @@ namespace WPEFramework { IARM_Bus_DSMgr_EventData_t *eventData = (IARM_Bus_DSMgr_EventData_t *)data; int hdmi_in_port = eventData->data.hdmi_in_video_mode.port; - dsVideoPortResolution_t resolution; + dsVideoPortResolution_t resolution = {}; resolution.pixelResolution = eventData->data.hdmi_in_video_mode.resolution.pixelResolution; resolution.interlaced = eventData->data.hdmi_in_video_mode.resolution.interlaced; resolution.frameRate = eventData->data.hdmi_in_video_mode.resolution.frameRate; diff --git a/LocationSync/LocationService.cpp b/LocationSync/LocationService.cpp index 075ffe7a05..77f7c8b250 100644 --- a/LocationSync/LocationService.cpp +++ b/LocationSync/LocationService.cpp @@ -325,6 +325,7 @@ namespace Plugin { , _remoteId() , _sourceNode() , _tryInterval(0) + , _retries(0) , _callback(callback) , _publicIPAddress() , _timeZone() diff --git a/Monitor/Monitor.h b/Monitor/Monitor.h index 1fca21862a..4045a385c3 100644 --- a/Monitor/Monitor.h +++ b/Monitor/Monitor.h @@ -927,10 +927,10 @@ namespace Plugin { { _adminLock.Lock(); - auto AddElement = [this, &response](const string& callsign, MonitorObject& object) { + auto AddElement = [this, &response](const string& callsignE, MonitorObject& object) { const MetaData& metaData = object.Measurement(); JsonData::Monitor::InfoInfo info; - info.Observable = callsign; + info.Observable = callsignE; if (object.HasRestartAllowed()) { info.Restart.Limit = object.RestartLimit(); diff --git a/Network/NetUtils.cpp b/Network/NetUtils.cpp index 0a29e459aa..1db492b324 100644 --- a/Network/NetUtils.cpp +++ b/Network/NetUtils.cpp @@ -201,7 +201,9 @@ namespace WPEFramework { if (deleteFile) { - std::remove(filepath); + if(std::remove(filepath) != 0){ + LOGERR("Failed to remove file: %s", filepath); + } } } } diff --git a/Network/NetUtilsNetlink.cpp b/Network/NetUtilsNetlink.cpp index 04c0df085a..d1a1df53df 100644 --- a/Network/NetUtilsNetlink.cpp +++ b/Network/NetUtilsNetlink.cpp @@ -33,6 +33,10 @@ namespace WPEFramework { m_fdNetlink(-1), m_netlinkProtect() { + m_nlSockaddr.nl_family = 0; + m_nlSockaddr.nl_pad = 0; + m_nlSockaddr.nl_pid = 0; + m_nlSockaddr.nl_groups = 0; } Netlink::~Netlink() diff --git a/Network/Network.cpp b/Network/Network.cpp index 970aaf110e..965b49f694 100644 --- a/Network/Network.cpp +++ b/Network/Network.cpp @@ -574,6 +574,7 @@ typedef struct _IARM_BUS_NetSrvMgr_Iface_EventData_t { IARM_BUS_NetSrvMgr_Iface_EventData_t param = {0}; strncpy(param.setInterface, interface.c_str(), INTERFACE_SIZE); + param.setInterface[sizeof(param.setInterface) - 1] = '\0'; if (IARM_RESULT_SUCCESS == IARM_Bus_Call (IARM_BUS_NM_SRV_MGR_NAME, IARM_BUS_NETSRVMGR_API_isInterfaceEnabled, (void*)¶m, sizeof(param))) { @@ -618,6 +619,7 @@ typedef struct _IARM_BUS_NetSrvMgr_Iface_EventData_t { IARM_BUS_NetSrvMgr_Iface_EventData_t iarmData = { 0 }; strncpy(iarmData.setInterface, interface.c_str(), INTERFACE_SIZE); + iarmData.setInterface[sizeof(iarmData.setInterface) - 1] = '\0'; iarmData.isInterfaceEnabled = enabled; iarmData.persist = persist; diff --git a/OpenCDMi/FrameworkRPC.cpp b/OpenCDMi/FrameworkRPC.cpp index f3da86318c..9b061a2a69 100644 --- a/OpenCDMi/FrameworkRPC.cpp +++ b/OpenCDMi/FrameworkRPC.cpp @@ -456,8 +456,8 @@ namespace Plugin { ASSERT(parent != nullptr); ASSERT(sessionData != nullptr); ASSERT(_mediaKeySession != nullptr); - - _mediaKeySession->Run(&_sink); + if(_mediaKeySession != nullptr) + _mediaKeySession->Run(&_sink); TRACE(Trace::Information, ("Server::Session::Session(%s,%s) => %p", _keySystem.c_str(), _sessionId.c_str(), this)); TRACE(Trace::Information, (_T("Constructed the Session Server side: %p"), this)); } @@ -486,7 +486,8 @@ namespace Plugin { ASSERT(_mediaKeySessionExt != nullptr); TRACE(Trace::Information, (_T("Constructed the Session Server side: %p"), this)); - _mediaKeySession->Run(&_sink); + if(_mediaKeySession != nullptr) + _mediaKeySession->Run(&_sink); TRACE(Trace::Information, (_T("Constructed the Session Server side: %p"), this)); } #ifdef __WINDOWS__ @@ -571,6 +572,10 @@ namespace Plugin { _adminLock.Unlock(); bufferid = _buffer->Name(); } + else { + _adminLock.Unlock(); + } + return bufferid; } diff --git a/OpenCDMi/OCDM.cpp b/OpenCDMi/OCDM.cpp index 1791970c9a..5886b05855 100644 --- a/OpenCDMi/OCDM.cpp +++ b/OpenCDMi/OCDM.cpp @@ -51,8 +51,8 @@ namespace OCDM { MemoryObserverImpl& operator=(const MemoryObserverImpl&); public: - MemoryObserverImpl(const RPC::IRemoteConnection* connection) - : _main(connection == 0 ? Core::ProcessInfo().Id() : connection->RemoteId()) + MemoryObserverImpl(const RPC::IRemoteConnection* connectionI) + : _main(connectionI == 0 ? Core::ProcessInfo().Id() : connectionI->RemoteId()) { } ~MemoryObserverImpl() diff --git a/OpenCDMi/OCDM.h b/OpenCDMi/OCDM.h index cbefe3538c..6b45d686d4 100644 --- a/OpenCDMi/OCDM.h +++ b/OpenCDMi/OCDM.h @@ -144,7 +144,8 @@ namespace Plugin { #pragma warning(disable : 4355) #endif OCDM() - : _service(nullptr) + : _skipURL(0) + , _service(nullptr) , _opencdmi(nullptr) , _memory(nullptr) , _notification(this) diff --git a/Packager/PackagerImplementation.cpp b/Packager/PackagerImplementation.cpp index b515b98529..98e55ecf8f 100644 --- a/Packager/PackagerImplementation.cpp +++ b/Packager/PackagerImplementation.cpp @@ -359,17 +359,17 @@ namespace Plugin { result = Core::ERROR_NONE; TRACE(Trace::Information, (_T("[Packager]: Successfully stored %s plugin's config in peristent path"), callsign.c_str())); } + controller->Release(); } else { TRACE(Trace::Error, (_T("[Packager]: Failed to find Controller interface"))); } - controller->Release(); } + shell->Release(); } else { TRACE(Trace::Error, (_T("[Packager]: Failed to find Shell interface"))); } - shell->Release(); return result; } @@ -402,8 +402,8 @@ namespace Plugin { TRACE(Trace::Error, (_T("[Packager]: Failed to move %s to Deactivated state"), callsign.c_str())); } } + dlPlugin->Release(); } - dlPlugin->Release(); } void PackagerImplementation::NotifyStateChange() diff --git a/PlayerInfo/PlayerInfo.h b/PlayerInfo/PlayerInfo.h index 5d18787337..dc9921f2f3 100644 --- a/PlayerInfo/PlayerInfo.h +++ b/PlayerInfo/PlayerInfo.h @@ -66,6 +66,7 @@ namespace Plugin { explicit DolbyNotification(PlayerInfo* parent) : _parent(*parent) + , _client(nullptr) { ASSERT(parent != nullptr); } @@ -110,6 +111,7 @@ namespace Plugin { , _player(nullptr) , _audioCodecs(nullptr) , _videoCodecs(nullptr) + , _dolbyOut(nullptr) , _dolbyNotification(this) , _notification(this) , _service(nullptr) diff --git a/RemoteActionMapping/RamHelper.cpp b/RemoteActionMapping/RamHelper.cpp index 6459632705..929e88c287 100644 --- a/RemoteActionMapping/RamHelper.cpp +++ b/RemoteActionMapping/RamHelper.cpp @@ -1091,16 +1091,12 @@ namespace WPEFramework { flags |= MSO_RIB_IRRFDB_RFRELEASED_BIT; LOGWARN("Discrete Power Off RF Descriptor included, size: %zu.", rfDescLength); break; - case XRC_RFKEY_TV_PWR_ON: - case XRC_RFKEY_AVR_PWR_ON: + default: rfDesc = (unsigned char*)rfDescriptor_DiscretePwrOn; rfDescLength = sizeof(rfDescriptor_DiscretePwrOn); flags |= MSO_RIB_IRRFDB_RFRELEASED_BIT; LOGWARN("Discrete Power On RF Descriptor included, size: %zu.", rfDescLength); break; - default: - LOGERR("LOGIC ERROR - Invalid separate power RF Key 0x%02X.", (unsigned)rfKeyCode); - break; } // Set the DeviceType flags field properly diff --git a/SystemServices/cTimer.h b/SystemServices/cTimer.h index 7c73455ef4..b44b82a94e 100644 --- a/SystemServices/cTimer.h +++ b/SystemServices/cTimer.h @@ -26,7 +26,7 @@ class cTimer{ private: bool clear; int interval; - void (*callBack_function)(); + void (*callBack_function)() = NULL; public: /*** * @brief : Constructor. diff --git a/SystemServices/platformcaps/platformcapsdata.cpp b/SystemServices/platformcaps/platformcapsdata.cpp index d43e9eec45..bc6d000cf9 100644 --- a/SystemServices/platformcaps/platformcapsdata.cpp +++ b/SystemServices/platformcaps/platformcapsdata.cpp @@ -222,7 +222,7 @@ PlatformCapsData::BrowserInfo PlatformCapsData::GetBrowser() const { string type; - Core::File file(OVERRIDE_WEBBACKEND_CONFIG_FILE); + Core::File file(string(OVERRIDE_WEBBACKEND_CONFIG_FILE)); if (!file.Open(true)) file = DEFAULT_WEBBACKEND_CONFIG_FILE; diff --git a/TextToSpeech/impl/logger.cpp b/TextToSpeech/impl/logger.cpp index 8c75192486..160f276096 100644 --- a/TextToSpeech/impl/logger.cpp +++ b/TextToSpeech/impl/logger.cpp @@ -41,8 +41,9 @@ namespace TTS { size_t colons = prettyFunction.find("::"); size_t begin = prettyFunction.substr(0,colons).rfind(" ") + 1; size_t end = prettyFunction.rfind("(") - begin; + const char *prettyFunctionSub = prettyFunction.substr(begin,end).c_str(); - return prettyFunction.substr(begin,end).c_str(); + return prettyFunctionSub; } #ifdef USE_RDK_LOGGER diff --git a/helpers/frontpanel.h b/helpers/frontpanel.h index d08ac6457c..a8ee8f0422 100644 --- a/helpers/frontpanel.h +++ b/helpers/frontpanel.h @@ -148,6 +148,10 @@ namespace WPEFramework class FrontPanelHelper { void setRemoteLedState(bool state); + + public: + ~FrontPanelHelper(); + }; } // namespace Plugin From 67d9381c26156b221421f7ef36281068fe3e1b05 Mon Sep 17 00:00:00 2001 From: melhar098 Date: Thu, 15 Feb 2024 13:36:42 -0500 Subject: [PATCH 2/2] RDK-45343: [Coverity][SECVULN] Various issues in rdkservices-Phase 2 Reason for change: Fix security vulnerabilities Test Procedure: Check for regressions Risks: Low Priority: P1 Signed-off-by: melhar098 --- Bluetooth/Bluetooth.cpp | 50 ++++++++++++------- Bluetooth/Bluetooth.h | 2 +- ContinueWatching/ContinueWatching.cpp | 19 ++----- ContinueWatching/ContinueWatching.h | 2 +- ControlService/ControlService.cpp | 2 +- DataCapture/DataCapture.cpp | 7 +-- .../DeviceSettings/PlatformImplementation.cpp | 2 +- FrontPanel/FrontPanel.cpp | 1 + LocationSync/LocationService.cpp | 1 - Network/NetUtils.cpp | 4 +- Network/NetUtilsNetlink.cpp | 5 +- Network/PingNotifier.cpp | 2 +- Packager/PackagerImplementation.cpp | 2 +- RemoteActionMapping/RamHelper.cpp | 3 +- 14 files changed, 47 insertions(+), 55 deletions(-) diff --git a/Bluetooth/Bluetooth.cpp b/Bluetooth/Bluetooth.cpp index 3e7b2611b1..17a279b7ba 100644 --- a/Bluetooth/Bluetooth.cpp +++ b/Bluetooth/Bluetooth.cpp @@ -143,7 +143,7 @@ namespace WPEFramework Bluetooth* Bluetooth::_instance = nullptr; static Core::TimerType _discoveryTimer(64 * 1024, "DiscoveryTimer"); - BTRMGR_Result_t bluetoothSrv_EventCallback (BTRMGR_EventMessage_t &eventMsg) + BTRMGR_Result_t bluetoothSrv_EventCallback (BTRMGR_EventMessage_t eventMsg) { if (!Bluetooth::_instance) { LOGERR ("Invalid pointer. Bluetooth is not initialized (yet?). Event of type %d ignored.", eventMsg.m_eventType); @@ -414,10 +414,15 @@ namespace WPEFramework JsonArray Bluetooth::getPairedDevices() { JsonArray deviceArray; - BTRMGR_PairedDevicesList_t *pairedDevices = (BTRMGR_PairedDevicesList_t)malloc(sizeof(BTRMGR_PairedDevicesList_t)); + BTRMGR_PairedDevicesList_t *pairedDevices = (BTRMGR_PairedDevicesList_t*)malloc(sizeof(BTRMGR_PairedDevicesList_t)); + if(pairedDevices == nullptr) + { + LOGERR("Failed to allocate memory"); + return deviceArray; + } - memset (&pairedDevices, 0, sizeof(pairedDevices)); - BTRMGR_Result_t rc = BTRMGR_GetPairedDevices(0, &pairedDevices); + memset (pairedDevices, 0, sizeof(BTRMGR_PairedDevicesList_t)); + BTRMGR_Result_t rc = BTRMGR_GetPairedDevices(0, pairedDevices); if (BTRMGR_RESULT_SUCCESS != rc) { LOGERR("Failed to get the paired devices"); @@ -426,26 +431,32 @@ namespace WPEFramework { int i = 0; JsonObject deviceDetails; - LOGINFO ("Success.... Paired %d Devices", pairedDevices.m_numOfDevices); - for (; i < pairedDevices.m_numOfDevices; i++) + LOGINFO ("Success.... Paired %d Devices", pairedDevices->m_numOfDevices); + for (; i < pairedDevices->m_numOfDevices; i++) { - deviceDetails["deviceID"] = std::to_string(pairedDevices.m_deviceProperty[i].m_deviceHandle); - deviceDetails["name"] = string(pairedDevices.m_deviceProperty[i].m_name); - deviceDetails["deviceType"] = string(BTRMGR_GetDeviceTypeAsString(pairedDevices.m_deviceProperty[i].m_deviceType)); - deviceDetails["connected"] = pairedDevices.m_deviceProperty[i].m_isConnected?true:false; + deviceDetails["deviceID"] = std::to_string(pairedDevices->m_deviceProperty[i].m_deviceHandle); + deviceDetails["name"] = string(pairedDevices->m_deviceProperty[i].m_name); + deviceDetails["deviceType"] = string(BTRMGR_GetDeviceTypeAsString(pairedDevices->m_deviceProperty[i].m_deviceType)); + deviceDetails["connected"] = pairedDevices->m_deviceProperty[i].m_isConnected?true:false; deviceArray.Add(deviceDetails); } } + free(pairedDevices); return deviceArray; } JsonArray Bluetooth::getConnectedDevices() { JsonArray deviceArray; - BTRMGR_ConnectedDevicesList_t *connectedDevices = (BTRMGR_ConnectedDevicesList_t)malloc(sizeof(BTRMGR_ConnectedDevicesList_t)); + BTRMGR_ConnectedDevicesList_t *connectedDevices = (BTRMGR_ConnectedDevicesList_t*)malloc(sizeof(BTRMGR_ConnectedDevicesList_t)); + if(connectedDevices == nullptr) + { + LOGERR("Failed to allocate memory"); + return deviceArray; + } - memset (&connectedDevices, 0, sizeof(connectedDevices)); - BTRMGR_Result_t rc = BTRMGR_GetConnectedDevices(0, &connectedDevices); + memset (connectedDevices, 0, sizeof(BTRMGR_ConnectedDevicesList_t)); + BTRMGR_Result_t rc = BTRMGR_GetConnectedDevices(0, connectedDevices); if (BTRMGR_RESULT_SUCCESS != rc) { LOGERR("Failed to get the connected devices"); @@ -454,16 +465,17 @@ namespace WPEFramework { int i = 0; JsonObject deviceDetails; - LOGINFO ("Success.... Connected %d Devices", connectedDevices.m_numOfDevices); - for (; i < connectedDevices.m_numOfDevices; i++) + LOGINFO ("Success.... Connected %d Devices", connectedDevices->m_numOfDevices); + for (; i < connectedDevices->m_numOfDevices; i++) { - deviceDetails["deviceID"] = std::to_string(connectedDevices.m_deviceProperty[i].m_deviceHandle); - deviceDetails["name"] = string(connectedDevices.m_deviceProperty[i].m_name); - deviceDetails["deviceType"] = string(BTRMGR_GetDeviceTypeAsString(connectedDevices.m_deviceProperty[i].m_deviceType)); - deviceDetails["activeState"] = std::to_string(connectedDevices.m_deviceProperty[i].m_powerStatus); + deviceDetails["deviceID"] = std::to_string(connectedDevices->m_deviceProperty[i].m_deviceHandle); + deviceDetails["name"] = string(connectedDevices->m_deviceProperty[i].m_name); + deviceDetails["deviceType"] = string(BTRMGR_GetDeviceTypeAsString(connectedDevices->m_deviceProperty[i].m_deviceType)); + deviceDetails["activeState"] = std::to_string(connectedDevices->m_deviceProperty[i].m_powerStatus); deviceArray.Add(deviceDetails); } } + free(connectedDevices); return deviceArray; } diff --git a/Bluetooth/Bluetooth.h b/Bluetooth/Bluetooth.h index e387d48db1..654e3983a3 100644 --- a/Bluetooth/Bluetooth.h +++ b/Bluetooth/Bluetooth.h @@ -183,7 +183,7 @@ namespace WPEFramework { public: static Bluetooth* _instance; - void notifyEventWrapper (BTRMGR_EventMessage_t eventMsg); + void notifyEventWrapper (BTRMGR_EventMessage_t &eventMsg); private: static const string STATUS_NO_BLUETOOTH_HARDWARE; diff --git a/ContinueWatching/ContinueWatching.cpp b/ContinueWatching/ContinueWatching.cpp index 9e54c86cbc..48d308d437 100644 --- a/ContinueWatching/ContinueWatching.cpp +++ b/ContinueWatching/ContinueWatching.cpp @@ -295,7 +295,6 @@ namespace WPEFramework { * @return None. */ ContinueWatchingImpl::ContinueWatchingImpl() - : mSecObjectId(0) { } @@ -540,7 +539,6 @@ namespace WPEFramework { char *jsonOut = NULL; cJSON *root = NULL; bool createNewJsonDoc = true; - size_t check_ret = 0; FILE *file = fopen(CW_LOCAL_FILE, "r"); if (file) { @@ -554,9 +552,7 @@ namespace WPEFramework { fseek(file, 0, SEEK_SET); if(numbytes >= 0) { - check_ret = fread(jsonDoc, numbytes, 1, file); - if(check_ret != 1) - LOGWARN("Failed to read from file: %s", file); + (void)fread(jsonDoc, numbytes, 1, file); } fclose(file); file = NULL; @@ -639,7 +635,6 @@ namespace WPEFramework { char *jsonDoc = NULL; std::string retVal = ""; FILE *file = fopen(CW_LOCAL_FILE, "r"); - size_t check_ret = 0; if (!file) return retVal; @@ -654,9 +649,7 @@ namespace WPEFramework { fseek(file, 0, SEEK_SET); if(numbytes >= 0) { - check_ret = fread(jsonDoc, numbytes, 1, file); - if(check_ret != 1) - LOGWARN("Failed to read from file: %s", file); + (void)fread(jsonDoc, numbytes, 1, file); } fclose(file); jsonDoc[numbytes] = '\0'; @@ -698,7 +691,6 @@ namespace WPEFramework { char *jsonOut = NULL; cJSON *root = NULL; bool retVal = false; - size_t check_ret = 0; if(!tr181FeatureEnabled()) { LOGWARN("Feature DISABLED...\n"); @@ -718,9 +710,7 @@ namespace WPEFramework { } fseek(file, 0, SEEK_SET); if(numbytes >= 0) { - check_ret = fread(jsonDoc, numbytes, 1, file); - if(check_ret != 1) - LOGWARN("Failed to read from file: %s", file); + (void)fread(jsonDoc, numbytes, 1, file); } fclose(file); file = NULL; @@ -777,11 +767,10 @@ namespace WPEFramework { */ std::string ContinueWatchingImpl::sha256(const std::string str) { - int check_update = 0; unsigned char hash[SHA256_DIGEST_LENGTH]; SHA256_CTX sha256Ctx; SHA256_Init(&sha256Ctx); - check_update = SHA256_Update(&sha256Ctx, str.c_str(), str.size()); + int check_update = SHA256_Update(&sha256Ctx, str.c_str(), str.size()); if(check_update == 0){ LOGWARN("Failed hash update"); } diff --git a/ContinueWatching/ContinueWatching.h b/ContinueWatching/ContinueWatching.h index 2ae215ee03..b30673bbd9 100644 --- a/ContinueWatching/ContinueWatching.h +++ b/ContinueWatching/ContinueWatching.h @@ -124,7 +124,7 @@ namespace WPEFramework { std::string mStrApplicationName; #if !defined(DISABLE_SECAPI) - SEC_OBJECTID mSecObjectId; + SEC_OBJECTID mSecObjectId = 0; #endif }; diff --git a/ControlService/ControlService.cpp b/ControlService/ControlService.cpp index 4743f19f42..f3c02fa613 100644 --- a/ControlService/ControlService.cpp +++ b/ControlService/ControlService.cpp @@ -84,8 +84,8 @@ namespace WPEFramework { ControlService::ControlService() : PluginHost::JSONRPC() - , m_numOfBindRemotes(0) , m_apiVersionNumber((uint32_t)-1) /* default max uint32_t so everything gets enabled */ //TODO(MROLLINS) Can't we access this from jsonrpc interface? + , m_numOfBindRemotes(0) { LOGINFO("ctor"); ControlService::_instance = this; diff --git a/DataCapture/DataCapture.cpp b/DataCapture/DataCapture.cpp index 597f4e146f..7690e8901f 100644 --- a/DataCapture/DataCapture.cpp +++ b/DataCapture/DataCapture.cpp @@ -103,12 +103,7 @@ namespace WPEFramework { Register(METHOD_ENABLE_AUDIO_CAPTURE, &DataCapture::enableAudioCaptureWrapper, this); Register(METHOD_GET_AUDIO_CLIP, &DataCapture::getAudioClipWrapper, this); - _audio_properties.format = acmFormate16BitStereo; - _audio_properties.sampling_frequency = acmFreqe16000; - _audio_properties.fifo_size = 0; - _audio_properties.threshold = 0; - _audio_properties.delay_compensation_ms = 0; - + _audio_properties = {}; _sock_adaptor.reset(new socket_adaptor()); } diff --git a/DisplayInfo/DeviceSettings/PlatformImplementation.cpp b/DisplayInfo/DeviceSettings/PlatformImplementation.cpp index 47f90f9b18..e2fd03ccb6 100644 --- a/DisplayInfo/DeviceSettings/PlatformImplementation.cpp +++ b/DisplayInfo/DeviceSettings/PlatformImplementation.cpp @@ -123,8 +123,8 @@ class DisplayInfoImplementation : ASSERT(index != _observers.end()); if (index != _observers.end()) { - _observers.erase(index); (*index)->Release(); + _observers.erase(index); } _adminLock.Unlock(); diff --git a/FrontPanel/FrontPanel.cpp b/FrontPanel/FrontPanel.cpp index 34612a74b8..409976a6a8 100644 --- a/FrontPanel/FrontPanel.cpp +++ b/FrontPanel/FrontPanel.cpp @@ -177,6 +177,7 @@ namespace WPEFramework FrontPanel::FrontPanel() : PluginHost::JSONRPC() , m_updateTimer(this) + , m_runUpdateTimer(false) { FrontPanel::_instance = this; m_runUpdateTimer = false; diff --git a/LocationSync/LocationService.cpp b/LocationSync/LocationService.cpp index 77f7c8b250..075ffe7a05 100644 --- a/LocationSync/LocationService.cpp +++ b/LocationSync/LocationService.cpp @@ -325,7 +325,6 @@ namespace Plugin { , _remoteId() , _sourceNode() , _tryInterval(0) - , _retries(0) , _callback(callback) , _publicIPAddress() , _timeZone() diff --git a/Network/NetUtils.cpp b/Network/NetUtils.cpp index 1db492b324..b4a476d32b 100644 --- a/Network/NetUtils.cpp +++ b/Network/NetUtils.cpp @@ -201,9 +201,7 @@ namespace WPEFramework { if (deleteFile) { - if(std::remove(filepath) != 0){ - LOGERR("Failed to remove file: %s", filepath); - } + (void)std::remove(filepath); } } } diff --git a/Network/NetUtilsNetlink.cpp b/Network/NetUtilsNetlink.cpp index d1a1df53df..4f3eedb94c 100644 --- a/Network/NetUtilsNetlink.cpp +++ b/Network/NetUtilsNetlink.cpp @@ -33,10 +33,7 @@ namespace WPEFramework { m_fdNetlink(-1), m_netlinkProtect() { - m_nlSockaddr.nl_family = 0; - m_nlSockaddr.nl_pad = 0; - m_nlSockaddr.nl_pid = 0; - m_nlSockaddr.nl_groups = 0; + m_nlSockaddr = {}; } Netlink::~Netlink() diff --git a/Network/PingNotifier.cpp b/Network/PingNotifier.cpp index 8beea86568..5f6b4cc97f 100644 --- a/Network/PingNotifier.cpp +++ b/Network/PingNotifier.cpp @@ -192,7 +192,7 @@ namespace WPEFramework if(!outputFile.empty()) { // clear up - remove(outputFile.c_str()); + (void)remove(outputFile.c_str()); } pingResult["guid"] = guid; diff --git a/Packager/PackagerImplementation.cpp b/Packager/PackagerImplementation.cpp index 98e55ecf8f..86b6cd6061 100644 --- a/Packager/PackagerImplementation.cpp +++ b/Packager/PackagerImplementation.cpp @@ -145,8 +145,8 @@ namespace Plugin { _adminLock.Lock(); auto item = std::find(_notifications.begin(), _notifications.end(), notification); ASSERT(item != _notifications.end()); - _notifications.erase(item); (*item)->Release(); + _notifications.erase(item); _adminLock.Unlock(); } diff --git a/RemoteActionMapping/RamHelper.cpp b/RemoteActionMapping/RamHelper.cpp index 929e88c287..8ec8deb807 100644 --- a/RemoteActionMapping/RamHelper.cpp +++ b/RemoteActionMapping/RamHelper.cpp @@ -1091,7 +1091,8 @@ namespace WPEFramework { flags |= MSO_RIB_IRRFDB_RFRELEASED_BIT; LOGWARN("Discrete Power Off RF Descriptor included, size: %zu.", rfDescLength); break; - default: + case XRC_RFKEY_TV_PWR_ON: + case XRC_RFKEY_AVR_PWR_ON: rfDesc = (unsigned char*)rfDescriptor_DiscretePwrOn; rfDescLength = sizeof(rfDescriptor_DiscretePwrOn); flags |= MSO_RIB_IRRFDB_RFRELEASED_BIT;