Fixing prevent critical defects in libprivilege-control and some log messages.
authorMarcin Niesluchowski <m.niesluchow@samsung.com>
Thu, 13 Jun 2013 15:11:14 +0000 (17:11 +0200)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Wed, 19 Jun 2013 09:17:10 +0000 (09:17 +0000)
Critical "Explicit null dereferenced" in function add_api_feture() in src/privilege-control.c fixed.
Critical "Explicit null dereferenced" in function get_all_ids_internal() in src/access-db.c
seems to be false warning.

[Issue#]        SSDWSSP-306
[Bug/Feature]   Fix prevent defects
[Cause]         Prevent server signalizes defects
[Solution]      N/A
[Verification]  Running tests and checking prevent output.

Change-Id: Ia0e407428629ddaa7da3df4a672e00cc0cd6bcf6

src/access-db.c
src/privilege-control.c

index aa36abf..38e9a3d 100644 (file)
@@ -132,7 +132,7 @@ static int get_all_ids_internal (char *** ids, int * len, db_app_type_t app_type
 
        file_db = fopen(db_file_name, "r");
        if (NULL == file_db) {
-               SECURE_LOGE("Error while opening antivirus_ids database file: %s", db_file_name);
+               SECURE_LOGE("Error while opening database file: %s", db_file_name);
                ret = PC_ERR_FILE_OPERATION;
                goto out;
        }
@@ -157,7 +157,7 @@ static int get_all_ids_internal (char *** ids, int * len, db_app_type_t app_type
                        C_LOGD("Found entry in database, but it's not correct SMACK label: \"%s\"", smack_label);
                        continue;
                }
-               C_LOGD("Found installed anti virus label: \"%s\"", smack_label);
+               C_LOGD("Found installed label: \"%s\"", smack_label);
                ++(*len);
                current = add_element(current, smack_label);
                if (NULL == current) {
index 25b814b..4ccad20 100644 (file)
@@ -2205,7 +2205,9 @@ API int add_api_feature(app_type_t app_type,
        // remove both files in case of failure
        if (ret != PC_OPERATION_SUCCESS) {
                unlink(smack_file);
-               unlink(dac_file);
+               if (dac_file) {
+                       unlink(dac_file);
+               }
        }
 
        return ret;