From: kamaljeet chauhan Date: Wed, 11 Mar 2020 10:07:04 +0000 (+0530) Subject: Coverity issue fixes X-Git-Tag: submit/tizen/20200311.101233^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F55%2F227355%2F1;p=platform%2Fcore%2Fmessaging%2Fmsg-service.git Coverity issue fixes Change-Id: I16e115e32b06b70e24f741a282842bf6364d6bd0 Signed-off-by: kamaljeet chauhan --- diff --git a/externals/MsgSensorWrapper.cpp b/externals/MsgSensorWrapper.cpp index bb8eb16..2daa1ba 100755 --- a/externals/MsgSensorWrapper.cpp +++ b/externals/MsgSensorWrapper.cpp @@ -134,7 +134,8 @@ void MsgSensorDisconnect() return; try { - gesture_stop_recognition(gestureHandler); + if(gesture_stop_recognition(gestureHandler)!= GESTURE_ERROR_NONE) + MSG_DEBUG("gesture_stop_recognition failed"); } catch(int exception) { MSG_FATAL("gesture_stop_recognition error [%d]", exception); } diff --git a/framework/plugin-manager/MsgPluginManager.cpp b/framework/plugin-manager/MsgPluginManager.cpp index aa0b83d..e743021 100755 --- a/framework/plugin-manager/MsgPluginManager.cpp +++ b/framework/plugin-manager/MsgPluginManager.cpp @@ -681,7 +681,7 @@ msg_error_t MsgSimMessageListener(MSG_MESSAGE_INFO_S *pMsg, int *simIdList, msg_ /*CID 48645: pEvent->data is an array hence null check is not required on it. */ if (retMsgId) { - memcpy(retMsgId, pEvent->data, sizeof(msg_message_id_t)); + memcpy(retMsgId, pEvent->data, sizeof(pEvent->data)); MSG_DEBUG("Saved SIM message ID = [%d]", *retMsgId); } diff --git a/include/common/MsgCmdTypes.h b/include/common/MsgCmdTypes.h index 587f5bc..748cc6d 100755 --- a/include/common/MsgCmdTypes.h +++ b/include/common/MsgCmdTypes.h @@ -43,7 +43,7 @@ typedef unsigned int MSG_EVENT_TYPE_T; typedef struct _MSG_CMD_S { MSG_CMD_TYPE_T cmdType; char cmdCookie[MAX_COOKIE_LEN]; - char cmdData[2]; + char cmdData[10]; } MSG_CMD_S; diff --git a/plugin/mms_plugin/MmsPluginInternal.cpp b/plugin/mms_plugin/MmsPluginInternal.cpp index 541fe37..3a21279 100755 --- a/plugin/mms_plugin/MmsPluginInternal.cpp +++ b/plugin/mms_plugin/MmsPluginInternal.cpp @@ -1175,7 +1175,10 @@ bool MmsPluginInternal::checkFilterMmsBody(MMS_DATA_S *pMmsData) } else { strncpy(filePath, pMedia->szFilePath, MSG_FILEPATH_LEN_MAX); - g_file_get_contents((const gchar*)filePath, (gchar**)&fileContent, NULL, NULL); + if(g_file_get_contents((const gchar*)filePath, (gchar**)&fileContent, NULL, NULL) == FALSE) + { + MSG_ERR("g_file_get_contents is failed"); + } bFiltered = MsgCheckFilterByWord(dbHandle, (const char *)fileContent); diff --git a/plugin/mms_plugin/MmsPluginMessage.cpp b/plugin/mms_plugin/MmsPluginMessage.cpp index 42a3daf..539fa74 100755 --- a/plugin/mms_plugin/MmsPluginMessage.cpp +++ b/plugin/mms_plugin/MmsPluginMessage.cpp @@ -1197,7 +1197,8 @@ bool MmsConvertMmsMsg(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData) gsize length = 0; if (MsgAccessFile(smil_multipart->szFilePath, F_OK)) { - g_file_get_contents((gchar*)smil_multipart->szFilePath, (gchar**)&contents, (gsize*)&length, NULL); + if(g_file_get_contents((gchar*)smil_multipart->szFilePath, (gchar**)&contents, (gsize*)&length, NULL) == FALSE) + MSG_ERR("g_file_get_contents is failed"); MmsInsertPresentation(pMmsMsg, MIME_APPLICATION_SMIL, NULL, contents, length); diff --git a/plugin/mms_plugin/MmsPluginStorage.cpp b/plugin/mms_plugin/MmsPluginStorage.cpp index 4844c51..75e1cf9 100755 --- a/plugin/mms_plugin/MmsPluginStorage.cpp +++ b/plugin/mms_plugin/MmsPluginStorage.cpp @@ -885,8 +885,10 @@ msg_error_t MmsPluginStorage::insertMultipart(msg_message_id_t msgId, MMS_MULTIP gchar *contents = NULL; gsize length = 0; - if (MsgAccessFile(pMultipart->szFilePath, F_OK)) - g_file_get_contents((gchar*)pMultipart->szFilePath, (gchar**)&contents, (gsize*)&length, NULL); + if (MsgAccessFile(pMultipart->szFilePath, F_OK)) { + if(g_file_get_contents((gchar*)pMultipart->szFilePath, (gchar**)&contents, (gsize*)&length, NULL) == FALSE) + MSG_ERR("g_file_get_contents is failed"); + } if (contents) { wrn = snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s " diff --git a/proxy/MsgHandleSetting.cpp b/proxy/MsgHandleSetting.cpp index 1502020..da80acb 100755 --- a/proxy/MsgHandleSetting.cpp +++ b/proxy/MsgHandleSetting.cpp @@ -814,7 +814,7 @@ msg_error_t MsgHandle::getGeneralOpt(msg_struct_t msg_struct) } if (pEvent->result == MSG_SUCCESS) { - memcpy(general_opt->data, pEvent->data, sizeof(MSG_GENERAL_OPT_S)); + memcpy(general_opt->data, pEvent->data, sizeof(pEvent->data)); } return pEvent->result; diff --git a/utils/MsgMmsMessage.cpp b/utils/MsgMmsMessage.cpp index 01af049..bbfe12c 100755 --- a/utils/MsgMmsMessage.cpp +++ b/utils/MsgMmsMessage.cpp @@ -1344,7 +1344,8 @@ int MsgMmsConvertMmsDataToMmsMessageData(MMS_DATA_S *pSrc, MMS_MESSAGE_DATA_S *p gchar *contents = NULL; gsize length = 0; - g_file_get_contents((gchar*)pSrc->smil->szFilePath, (gchar**)&contents, (gsize*)&length, NULL); + if(g_file_get_contents((gchar*)pSrc->smil->szFilePath, (gchar**)&contents, (gsize*)&length, NULL) == FALSE) + MSG_ERR("g_file_get_contents is failed"); if (contents) { MsgSmilParseSmilDoc(pDst, contents);