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
|
|
@ -136,11 +136,17 @@ OpenAPI_dnn_route_selection_descriptor_t *OpenAPI_dnn_route_selection_descriptor
|
|||
ssc_modesList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(ssc_modes_local, ssc_modes) {
|
||||
OpenAPI_ssc_mode_e localEnum = OpenAPI_ssc_mode_NULL;
|
||||
if (!cJSON_IsString(ssc_modes_local)) {
|
||||
ogs_error("OpenAPI_dnn_route_selection_descriptor_parseFromJSON() failed [ssc_modes]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(ssc_modesList, (void *)OpenAPI_ssc_mode_FromString(ssc_modes_local->valuestring));
|
||||
localEnum = OpenAPI_ssc_mode_FromString(ssc_modes_local->valuestring);
|
||||
if (!localEnum) {
|
||||
ogs_error("OpenAPI_ssc_mode_FromString(ssc_modes_local->valuestring) failed");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(ssc_modesList, (void *)localEnum);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -155,11 +161,17 @@ OpenAPI_dnn_route_selection_descriptor_t *OpenAPI_dnn_route_selection_descriptor
|
|||
pdu_sess_typesList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(pdu_sess_types_local, pdu_sess_types) {
|
||||
OpenAPI_pdu_session_type_e localEnum = OpenAPI_pdu_session_type_NULL;
|
||||
if (!cJSON_IsString(pdu_sess_types_local)) {
|
||||
ogs_error("OpenAPI_dnn_route_selection_descriptor_parseFromJSON() failed [pdu_sess_types]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(pdu_sess_typesList, (void *)OpenAPI_pdu_session_type_FromString(pdu_sess_types_local->valuestring));
|
||||
localEnum = OpenAPI_pdu_session_type_FromString(pdu_sess_types_local->valuestring);
|
||||
if (!localEnum) {
|
||||
ogs_error("OpenAPI_pdu_session_type_FromString(pdu_sess_types_local->valuestring) failed");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(pdu_sess_typesList, (void *)localEnum);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue