Fix issue that detected by static analysis tool 49/175949/4
authorsungwook79.park <sungwook79.park@samsung.com>
Mon, 16 Apr 2018 01:49:38 +0000 (10:49 +0900)
committersungwook79.park <sungwook79.park@samsung.com>
Mon, 16 Apr 2018 02:04:02 +0000 (11:04 +0900)
Change-Id: I19f17bf5f55da4f0a9a5d16ab179c9be95887ece
Signed-off-by: sungwook79.park <sungwook79.park@samsung.com>
src/privilege_checker.cpp

index 12a9c7d..37971a5 100644 (file)
@@ -45,7 +45,7 @@ check_privilege(const char *uid, const char *privilege)
 {
     FILE *fp = NULL;
     char label_path[1024] = "/proc/self/attr/current";
-    char smack_label[1024] = {0};
+    char smack_label[1024] = {'\0', };
 
     if (!p_cynara) {
         return false;
@@ -53,7 +53,7 @@ check_privilege(const char *uid, const char *privilege)
 
     fp = fopen(label_path, "r");
     if (fp != NULL) {
-        if (fread(smack_label, 1, sizeof(smack_label), fp) <= 0) {
+        if (fread(smack_label, 1, sizeof(smack_label) - 1, fp) <= 0) {
             LOGW("[check_privilege] fail to fread");
         }
         fclose(fp);