mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-02 13:20:08 +00:00
[SBI] crash when enum is unknown (#2622)
j
The crash is caused by ogs_assert(data) in listEntry_create(void *data).
Reason for the failing assertion is that in
OpenAPI_subscription_data_t *OpenAPI_subscription_data_parseFromJSON(
cJSON *subscription_dataJSON)
in line 501 of file subscription_data.c the event string is transformed
into an integer/enum value, which in case of an unknown event is 0.
Steps to reproduce:
1. Deploy NRF
2. Run curl --http2-prior-knowledge --header "Content-Type: application/json" --data '{"nfStatusNotificationUri": "test@example.com", "reqNotifEvents": ["unknown"], "subscriptionId": "12345"}' "http://<NRF_IP>:<NRF_PORT>/nnrf-nfm/v1/subscriptions"
This commit is contained in:
parent
317d9bf846
commit
0abfb204ea
72 changed files with 854 additions and 122 deletions
|
|
@ -1126,11 +1126,17 @@ OpenAPI_sm_policy_update_context_data_t *OpenAPI_sm_policy_update_context_data_p
|
|||
rep_policy_ctrl_req_triggersList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(rep_policy_ctrl_req_triggers_local, rep_policy_ctrl_req_triggers) {
|
||||
OpenAPI_policy_control_request_trigger_e localEnum = OpenAPI_policy_control_request_trigger_NULL;
|
||||
if (!cJSON_IsString(rep_policy_ctrl_req_triggers_local)) {
|
||||
ogs_error("OpenAPI_sm_policy_update_context_data_parseFromJSON() failed [rep_policy_ctrl_req_triggers]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(rep_policy_ctrl_req_triggersList, (void *)OpenAPI_policy_control_request_trigger_FromString(rep_policy_ctrl_req_triggers_local->valuestring));
|
||||
localEnum = OpenAPI_policy_control_request_trigger_FromString(rep_policy_ctrl_req_triggers_local->valuestring);
|
||||
if (!localEnum) {
|
||||
ogs_error("OpenAPI_policy_control_request_trigger_FromString(rep_policy_ctrl_req_triggers_local->valuestring) failed");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(rep_policy_ctrl_req_triggersList, (void *)localEnum);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1686,11 +1692,17 @@ OpenAPI_sm_policy_update_context_data_t *OpenAPI_sm_policy_update_context_data_p
|
|||
policy_dec_failure_reportsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(policy_dec_failure_reports_local, policy_dec_failure_reports) {
|
||||
OpenAPI_policy_decision_failure_code_e localEnum = OpenAPI_policy_decision_failure_code_NULL;
|
||||
if (!cJSON_IsString(policy_dec_failure_reports_local)) {
|
||||
ogs_error("OpenAPI_sm_policy_update_context_data_parseFromJSON() failed [policy_dec_failure_reports]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(policy_dec_failure_reportsList, (void *)OpenAPI_policy_decision_failure_code_FromString(policy_dec_failure_reports_local->valuestring));
|
||||
localEnum = OpenAPI_policy_decision_failure_code_FromString(policy_dec_failure_reports_local->valuestring);
|
||||
if (!localEnum) {
|
||||
ogs_error("OpenAPI_policy_decision_failure_code_FromString(policy_dec_failure_reports_local->valuestring) failed");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(policy_dec_failure_reportsList, (void *)localEnum);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1761,11 +1773,17 @@ OpenAPI_sm_policy_update_context_data_t *OpenAPI_sm_policy_update_context_data_p
|
|||
types_of_notifList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(types_of_notif_local, types_of_notif) {
|
||||
OpenAPI_dl_data_delivery_status_e localEnum = OpenAPI_dl_data_delivery_status_NULL;
|
||||
if (!cJSON_IsString(types_of_notif_local)) {
|
||||
ogs_error("OpenAPI_sm_policy_update_context_data_parseFromJSON() failed [types_of_notif]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(types_of_notifList, (void *)OpenAPI_dl_data_delivery_status_FromString(types_of_notif_local->valuestring));
|
||||
localEnum = OpenAPI_dl_data_delivery_status_FromString(types_of_notif_local->valuestring);
|
||||
if (!localEnum) {
|
||||
ogs_error("OpenAPI_dl_data_delivery_status_FromString(types_of_notif_local->valuestring) failed");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(types_of_notifList, (void *)localEnum);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue