Merge "Fix null-terminated string issue after fread @download-provider-security.c... accepted/tizen/unified/20180508.071607 submit/tizen/20180508.012433
authorTaesoo Jun <steve.jun@samsung.com>
Tue, 8 May 2018 01:21:56 +0000 (01:21 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Tue, 8 May 2018 01:21:56 +0000 (01:21 +0000)
provider/download-provider-security.c

index 8d0af25..15ff4a9 100644 (file)
@@ -107,7 +107,7 @@ static int _dp_check_dir_permission(dp_credential cred, const char *privilege)
                cynara_finish(p_cynara);
                return -1;
        }
-       ret = fread(client_smack, MAX_ARRAY_LEN, 1, fd);
+       ret = fread(client_smack, 1, MAX_ARRAY_LEN, fd);
        if (ferror(fd)) {
                TRACE_ERROR("Failed to read %s", client_smack_path);
                fclose(fd);
@@ -115,6 +115,7 @@ static int _dp_check_dir_permission(dp_credential cred, const char *privilege)
                return -1;
        }
        fclose(fd);
+       client_smack[ret] = '\0';
 
        snprintf(uid, sizeof(uid), "%d", cred.uid);