SVACE issues Fix 86/199586/2 accepted/tizen/unified/20190214.154107 submit/tizen/20190214.061428
authorsrinivasa.m <srinivasa.m@samsung.com>
Wed, 13 Feb 2019 06:41:00 +0000 (12:11 +0530)
committersrinivasa.m <srinivasa.m@samsung.com>
Wed, 13 Feb 2019 12:32:31 +0000 (18:02 +0530)
Change-Id: I531df4a0c1d0ec4d4478d0560ec2a7c5535f1f51

common/fido_json_handler.c
server/fido_server.c
server/fido_uaf_policy_checker.c [changed mode: 0644->0755]

index e5c276e..31b4aff 100755 (executable)
@@ -885,6 +885,7 @@ _uaf_parser_parse_asm_response_discover_client(char **asm_response_list, int len
 
                                int auth_index = json_object_get_int_member(auth_obj, _JSON_KEY_AUTH_INDEX);
                                char *auth_idx_str = (char*)calloc(1, 128);
+                               CATCH_IF_FAIL(auth_idx_str != NULL);
                                snprintf(auth_idx_str, 127, "%d", auth_index);
 
                                auth_info->auth_index = auth_idx_str;
@@ -981,6 +982,7 @@ _uaf_parser_parse_asm_response_discover_client(char **asm_response_list, int len
 
                                /* Supported UAF versions is fixed to 1.0*/
                                 fido_version_s *version = calloc(1, sizeof(fido_version_s));
+                                CATCH_IF_FAIL(version != NULL);
                                 version->major = _VERSION_MAJOR;
                                 version->minor = _VERSION_MINOR;
 
@@ -1098,10 +1100,11 @@ _uaf_parser_parse_asm_response_discover(GList *asm_response_list, int *error_cod
                                JsonObject *auth_obj = json_array_get_object_element(auth_arr, auth_arr_index);
                                if (auth_obj != NULL) {
                                        fido_authenticator_s *auth_info = (fido_authenticator_s *)calloc(1, sizeof(fido_authenticator_s));
-
+                                       CATCH_IF_FAIL(auth_info != NULL);
 
                                        int auth_index = json_object_get_int_member(auth_obj, _JSON_KEY_AUTH_INDEX);
                                        char *auth_idx_str = (char*)calloc(1, 128);
+                                       CATCH_IF_FAIL(auth_idx_str != NULL);
                                        snprintf(auth_idx_str, 127, "%d", auth_index);
 
                                        auth_info->auth_index = auth_idx_str;
@@ -2776,7 +2779,7 @@ __get_transaction_list(JsonObject *uaf_obj)
                if (tr_obj != NULL) {
 
                        _auth_transaction_t *trans = calloc(1, sizeof(_auth_transaction_t));
-
+                       RET_IF_FAIL(trans != NULL, NULL);
                        trans->content_type = __get_string_from_json_object(tr_obj, _JSON_KEY_CONTENT_TYPE);
                        trans->content = __get_string_from_json_object(tr_obj, _JSON_KEY_CONTENT);
 
@@ -3085,6 +3088,7 @@ _uaf_parser_parse_uaf_response(const char *uaf_response)
                        if (assrt_json_obj != NULL) {
 
                                _auth_reg_assertion_t *assrt_data = (_auth_reg_assertion_t*)calloc(1, sizeof(_auth_reg_assertion_t));
+                               CATCH_IF_FAIL(assrt_data != NULL);
                                assrt_data->assertion = __get_string_from_json_object(assrt_json_obj, _JSON_KEY_ASSERTION);
                                assrt_data->assertion_schm = __get_string_from_json_object(assrt_json_obj, _JSON_KEY_ASSERT_SCHEME);
 
@@ -3174,7 +3178,7 @@ _uaf_parser_parser_asm_get_reg_response(const char *get_reg_resp)
 
                        if (app_id != NULL || key_id_list != NULL) {
                                _asm_app_reg_t *app_reg = (_asm_app_reg_t*) calloc(1, sizeof(_asm_app_reg_t));
-
+                               CATCH_IF_FAIL(app_reg != NULL);
                                if (app_id != NULL) {
                                        _INFO("app_id = [%s]", app_id);
                                        app_reg->app_id = strdup(app_id);
index 9afed7c..a036116 100755 (executable)
@@ -536,12 +536,12 @@ __copy_convert_uaf_trans_list(GList *uaf_tr_list)
                _auth_transaction_t *uaf_tr = (_auth_transaction_t*)(uaf_tr_list_iter->data);
 
                _fido_asm_transaction_t *asm_tr = calloc(1, sizeof(_fido_asm_transaction_t));
-
+               RET_IF_FAIL(asm_tr != NULL, NULL);
                asm_tr->content = __dup_string(uaf_tr->content);
                asm_tr->content_type = __dup_string(uaf_tr->content_type);
                if (uaf_tr->display_charac != NULL) {
                        asm_tr->display_charac = calloc(1, sizeof(_fido_asm_display_png_characteristics_descriptor_t));
-
+                       RET_IF_FAIL(asm_tr->display_charac != NULL, NULL);
                        asm_tr->display_charac->bit_depth = uaf_tr->display_charac->bit_depth;
                        asm_tr->display_charac->color_type = uaf_tr->display_charac->color_type;
                        asm_tr->display_charac->compression = uaf_tr->display_charac->compression;
@@ -557,6 +557,7 @@ __copy_convert_uaf_trans_list(GList *uaf_tr_list)
                                        fido_rgb_pallette_entry_s *uaf_plte_entry = (fido_rgb_pallette_entry_s*)(uaf_plte_iter->data);
 
                                        fido_rgb_pallette_entry_s *asm_plte_entry = calloc(1, sizeof(fido_rgb_pallette_entry_s));
+                                       RET_IF_FAIL(asm_plte_entry != NULL, NULL);
                                        asm_plte_entry->r = uaf_plte_entry->r;
                                        asm_plte_entry->g = uaf_plte_entry->g;
                                        asm_plte_entry->b = uaf_plte_entry->b;
@@ -1169,6 +1170,7 @@ _discover_response_cb_for_process(int tz_error_code, int error_code, GList *avai
                        if (match_data != NULL) {
 
                                _ui_auth_data_t *ui_data = (_ui_auth_data_t*) calloc(1, sizeof(_ui_auth_data_t));
+                               RET_IF_FAIL_VOID(ui_data != NULL);
                                if (match_data->asm_id != NULL)
                                        ui_data->asm_id = strdup(match_data->asm_id);
                                else
old mode 100644 (file)
new mode 100755 (executable)
index f055ac8..4abb312
@@ -360,7 +360,7 @@ __copy_png_list(GList *src_list)
                if (src_data != NULL) {
                        fido_display_png_characteristics_descriptor_s *dest_data =
                                        calloc(1, sizeof(fido_display_png_characteristics_descriptor_s));
-
+                       RET_IF_FAIL(dest_data != NULL, NULL);
                        dest_data->bit_depth = src_data->bit_depth;
                        dest_data->color_type = src_data->color_type;
                        dest_data->compression = src_data->compression;
@@ -376,6 +376,7 @@ __copy_png_list(GList *src_list)
                                        fido_rgb_pallette_entry_s *plte_src_data = (fido_rgb_pallette_entry_s*)(p_iter->data);
                                        if (plte_src_data != NULL) {
                                                fido_rgb_pallette_entry_s *plte_dest_data = calloc(1, sizeof(fido_rgb_pallette_entry_s));
+                                               RET_IF_FAIL(plte_dest_data != NULL, NULL);
                                                plte_dest_data->r = plte_src_data->r;
                                                plte_dest_data->g = plte_src_data->g;
                                                plte_dest_data->b = plte_src_data->b;
@@ -559,7 +560,7 @@ _policy_checker_get_matched_auth_list(_policy_t *policy, GList *auth_list)
                        for (; allowed_list_iter_next != NULL; allowed_list_iter_next = allowed_list_iter_next->next) {
 
                                _matched_auth_data_t *matched_auth_data_nxt = (_matched_auth_data_t*)allowed_list_iter_next->data;
-
+                               RET_IF_FAIL(matched_auth_data_nxt != NULL, NULL);
                                if (strcmp(matched_auth_data_nxt->asm_id, matched_auth_data->asm_id) == 0) {
                                        if (strcmp(matched_auth_data_nxt->auth_index, matched_auth_data->auth_index) == 0) {