Coverity issue fixes 55/227355/1 accepted/tizen/unified/20200316.220915 submit/tizen/20200311.101233
authorkamaljeet chauhan <kamal.jc@samsung.com>
Wed, 11 Mar 2020 10:07:04 +0000 (15:37 +0530)
committerkamaljeet chauhan <kamal.jc@samsung.com>
Wed, 11 Mar 2020 10:07:04 +0000 (15:37 +0530)
Change-Id: I16e115e32b06b70e24f741a282842bf6364d6bd0
Signed-off-by: kamaljeet chauhan <kamal.jc@samsung.com>
externals/MsgSensorWrapper.cpp
framework/plugin-manager/MsgPluginManager.cpp
include/common/MsgCmdTypes.h
plugin/mms_plugin/MmsPluginInternal.cpp
plugin/mms_plugin/MmsPluginMessage.cpp
plugin/mms_plugin/MmsPluginStorage.cpp
proxy/MsgHandleSetting.cpp
utils/MsgMmsMessage.cpp

index bb8eb16..2daa1ba 100755 (executable)
@@ -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);
        }
index aa0b83d..e743021 100755 (executable)
@@ -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);
        }
 
index 587f5bc..748cc6d 100755 (executable)
@@ -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;
 
 
index 541fe37..3a21279 100755 (executable)
@@ -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);
 
index 42a3daf..539fa74 100755 (executable)
@@ -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);
 
index 4844c51..75e1cf9 100755 (executable)
@@ -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 "
index 1502020..da80acb 100755 (executable)
@@ -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;
index 01af049..bbfe12c 100755 (executable)
@@ -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);