Fix issue that detected by static analysis tool 09/177209/1
authorsungwook79.park <sungwook79.park@samsung.com>
Thu, 26 Apr 2018 07:12:23 +0000 (16:12 +0900)
committersungwook79.park <sungwook79.park@samsung.com>
Thu, 26 Apr 2018 07:12:46 +0000 (16:12 +0900)
Change-Id: Ib95ea84d559e1d79e286f88ca7a875a6ccbfeee1
Signed-off-by: sungwook79.park <sungwook79.park@samsung.com>
src/privilege_checker.cpp

index 5afdc1a..1e4c0aa 100644 (file)
@@ -54,7 +54,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("Error : fread");
 
         fclose(fp);