client crash fixed 77/80377/1 accepted/tizen/common/20160718.155612 accepted/tizen/ivi/20160718.104336 accepted/tizen/mobile/20160718.104113 accepted/tizen/wearable/20160718.104100 submit/tizen/20160718.020011
authorKyeonghun Lee <kh9090.lee@samsung.com>
Mon, 18 Jul 2016 00:26:53 +0000 (09:26 +0900)
committerKyeonghun Lee <kh9090.lee@samsung.com>
Mon, 18 Jul 2016 00:26:53 +0000 (09:26 +0900)
Change-Id: I94e512f0f22fd7eb9847c441a9197af3106d20ed
Signed-off-by: Kyeonghun Lee <kh9090.lee@samsung.com>
utils/MsgUtilFile.cpp

index 83a0b50..510d8f1 100755 (executable)
@@ -334,6 +334,16 @@ bool MsgOpenAndReadFile(const char *pFileName, char **ppData, int *pDataSize)
        snprintf(fullPath, MAX_FULL_PATH_SIZE, "%s%s", MSG_IPC_DATA_PATH, pFileName);
        MSG_SEC_DEBUG("open file name: %s", fullPath);
 
+       struct stat st;
+       if (stat(fullPath, &st) != 0) {
+               MSG_SEC_ERR("stat(%s, &st) != 0", fullPath);
+               return false;
+       }
+       if (S_ISDIR(st.st_mode)) {
+               MSG_ERR("S_ISDIR(st.st_mode)");
+               return false;
+       }
+
        pFile = MsgOpenFile(fullPath, "rb");
 
        if (pFile == NULL) {