mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-02 05:10:10 +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
|
|
@ -98,11 +98,17 @@ OpenAPI_downlink_data_notification_control_t *OpenAPI_downlink_data_notification
|
|||
notif_ctrl_indsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(notif_ctrl_inds_local, notif_ctrl_inds) {
|
||||
OpenAPI_notification_control_indication_e localEnum = OpenAPI_notification_control_indication_NULL;
|
||||
if (!cJSON_IsString(notif_ctrl_inds_local)) {
|
||||
ogs_error("OpenAPI_downlink_data_notification_control_parseFromJSON() failed [notif_ctrl_inds]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(notif_ctrl_indsList, (void *)OpenAPI_notification_control_indication_FromString(notif_ctrl_inds_local->valuestring));
|
||||
localEnum = OpenAPI_notification_control_indication_FromString(notif_ctrl_inds_local->valuestring);
|
||||
if (!localEnum) {
|
||||
ogs_error("OpenAPI_notification_control_indication_FromString(notif_ctrl_inds_local->valuestring) failed");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(notif_ctrl_indsList, (void *)localEnum);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -117,11 +123,17 @@ OpenAPI_downlink_data_notification_control_t *OpenAPI_downlink_data_notification
|
|||
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_downlink_data_notification_control_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