[NRF] Fixed crash due to invalid PATCH body (#2735)

This commit is contained in:
Sukchan Lee 2023-11-25 22:03:28 +09:00
parent 7278714133
commit ab1c3493c6
5 changed files with 35 additions and 1 deletions

View File

@ -1393,6 +1393,11 @@ static int parse_json(ogs_sbi_message_t *message,
}
patch_item = OpenAPI_patch_item_parseFromJSON(patchJSON);
if (!patch_item) {
rv = OGS_ERROR;
ogs_error("No PatchItem");
goto cleanup;
}
OpenAPI_list_add(message->PatchItemList, patch_item);
}
}
@ -1698,6 +1703,11 @@ static int parse_json(ogs_sbi_message_t *message,
}
smsub_item = OpenAPI_session_management_subscription_data_parseFromJSON(smsubJSON);
if (!smsub_item) {
rv = OGS_ERROR;
ogs_error("No smsub_item");
goto cleanup;
}
OpenAPI_list_add(message->SessionManagementSubscriptionDataList, smsub_item);
}
}
@ -1860,6 +1870,11 @@ static int parse_json(ogs_sbi_message_t *message,
}
smsub_item = OpenAPI_session_management_subscription_data_parseFromJSON(smsubJSON);
if (!smsub_item) {
rv = OGS_ERROR;
ogs_error("No smsub_item");
goto cleanup;
}
OpenAPI_list_add(message->SessionManagementSubscriptionDataList, smsub_item);
}
}
@ -3287,7 +3302,10 @@ int ogs_sbi_discovery_option_parse_plmn_list(
}
PlmnId = OpenAPI_plmn_id_parseFromJSON(PlmnIdJSON);
ogs_assert(PlmnId);
if (!PlmnId) {
ogs_error("No PlmnId");
goto cleanup;
}
OpenAPI_list_add(PlmnList, PlmnId);
}

View File

@ -726,6 +726,10 @@ static int update_rat_res_add_one(cJSON *restriction,
}
restr = (void *) OpenAPI_rat_type_FromString(cJSON_GetStringValue(restriction));
if (!restr) {
ogs_error("No restr");
return OGS_ERROR;
}
if (index == restrictions->count) {
OpenAPI_list_add(restrictions, restr);

View File

@ -202,8 +202,10 @@ bool ausf_nudm_ueau_handle_get(ausf_ue_t *ausf_ue,
LinksValueScheme = OpenAPI_map_create(
(char *)links_member_name(UeAuthenticationCtx.auth_type),
&LinksValueSchemeValue);
ogs_assert(LinksValueScheme);
UeAuthenticationCtx._links = OpenAPI_list_create();
ogs_assert(UeAuthenticationCtx._links);
OpenAPI_list_add(UeAuthenticationCtx._links, LinksValueScheme);
memset(&sendmsg, 0, sizeof(sendmsg));

View File

@ -893,6 +893,11 @@ bool nrf_nnrf_handle_nf_discover(
discovery_option->requester_features,
OGS_SBI_NNRF_DISC_SERVICE_MAP) ? true : false);
if (!NFProfile) {
ogs_error("No NFProfile");
continue;
}
OpenAPI_list_add(SearchResult->nf_instances, NFProfile);
i++;

View File

@ -696,6 +696,11 @@ bool udm_nudr_dr_handle_subscription_provisioned(
OpenAPI_session_management_subscription_data_t *item = NULL;
item = OpenAPI_session_management_subscription_data_copy(item, node->data);
if (!item) {
ogs_error("OpenAPI_session_management_subscription_data_copy() "
"failed");
continue;
}
OpenAPI_list_add(sendmsg.SessionManagementSubscriptionDataList, item);
}