Fix to check privilege issue 39/82439/1
authorsungwook79.park <sungwook79.park@samsung.com>
Wed, 3 Aug 2016 10:10:57 +0000 (19:10 +0900)
committersungwook79.park <sungwook79.park@samsung.com>
Wed, 3 Aug 2016 10:10:57 +0000 (19:10 +0900)
Change-Id: I27ac0b6a735ffcf94f161f813792adbb9593ab98
Signed-off-by: sungwook79.park <sungwook79.park@samsung.com>
src/privilege_checker.cpp

index 014bb56..2b2ae90 100644 (file)
@@ -44,13 +44,14 @@ bool
 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("/proc/self/attr/current", "r");
+    fp = fopen(label_path, "r");
     if (fp != NULL) {
         if (fread(smack_label, 1, sizeof(smack_label), fp) <= 0);
         fclose(fp);