Correct to check return of fread 11/175811/2 accepted/tizen/unified/20180424.082632 submit/tizen/20180419.133139 submit/tizen/20180419.231015
authorWonnam Jang <wn.jang@samsung.com>
Thu, 12 Apr 2018 11:28:21 +0000 (20:28 +0900)
committerWonnam Jang <wn.jang@samsung.com>
Thu, 12 Apr 2018 11:31:08 +0000 (20:31 +0900)
Change-Id: Ie3e23db19d239d32074d4591ba0666c43aab20f8
Signed-off-by: Wonnam Jang <wn.jang@samsung.com>
src/vc_elm.c

index 4f883cf..231e0d0 100644 (file)
@@ -121,15 +121,16 @@ static int __check_privilege_initialize()
 static int __check_privilege(const char* uid, const char * privilege)
 {
        FILE *fp = NULL;
-       char smack_label[1024] = "/proc/self/attr/current";
+       char label_path[1024] = "/proc/self/attr/current";
+       char smack_label[1024] = {'\0',};
 
        if (!p_cynara) {
                return false;
        }
 
-       fp = fopen(smack_label, "r");
+       fp = fopen(label_path, "r");
        if (fp != NULL) {
-               if (sizeof(smack_label) != fread(smack_label, 1, sizeof(smack_label), fp))
+               if (0 >= fread(smack_label, 1, sizeof(smack_label), fp))
                        VC_ELM_LOG_ERR("[ERROR] fail to fread");
 
                fclose(fp);