From e3b62a5cce5ff33f9fcaa97b98ee78c460cbc2b1 Mon Sep 17 00:00:00 2001 From: Kyeonghun Lee Date: Mon, 18 Jul 2016 09:26:53 +0900 Subject: [PATCH] client crash fixed Change-Id: I94e512f0f22fd7eb9847c441a9197af3106d20ed Signed-off-by: Kyeonghun Lee --- utils/MsgUtilFile.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/utils/MsgUtilFile.cpp b/utils/MsgUtilFile.cpp index 83a0b50..510d8f1 100755 --- a/utils/MsgUtilFile.cpp +++ b/utils/MsgUtilFile.cpp @@ -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) { -- 2.34.1