mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-04 22:30:09 +00:00
[SBI] Crash occurs when ENUM in the MAP (#2103)
This commit is contained in:
parent
ce668c556c
commit
969c116e77
1097 changed files with 266728 additions and 42047 deletions
|
|
@ -24,25 +24,36 @@ OpenAPI_assign_ebi_data_t *OpenAPI_assign_ebi_data_create(
|
|||
|
||||
void OpenAPI_assign_ebi_data_free(OpenAPI_assign_ebi_data_t *assign_ebi_data)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == assign_ebi_data) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_list_for_each(assign_ebi_data->arp_list, node) {
|
||||
OpenAPI_arp_free(node->data);
|
||||
if (assign_ebi_data->arp_list) {
|
||||
OpenAPI_list_for_each(assign_ebi_data->arp_list, node) {
|
||||
OpenAPI_arp_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(assign_ebi_data->arp_list);
|
||||
assign_ebi_data->arp_list = NULL;
|
||||
}
|
||||
OpenAPI_list_free(assign_ebi_data->arp_list);
|
||||
OpenAPI_list_for_each(assign_ebi_data->released_ebi_list, node) {
|
||||
ogs_free(node->data);
|
||||
if (assign_ebi_data->released_ebi_list) {
|
||||
OpenAPI_list_for_each(assign_ebi_data->released_ebi_list, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(assign_ebi_data->released_ebi_list);
|
||||
assign_ebi_data->released_ebi_list = NULL;
|
||||
}
|
||||
if (assign_ebi_data->old_guami) {
|
||||
OpenAPI_guami_free(assign_ebi_data->old_guami);
|
||||
assign_ebi_data->old_guami = NULL;
|
||||
}
|
||||
OpenAPI_list_free(assign_ebi_data->released_ebi_list);
|
||||
OpenAPI_guami_free(assign_ebi_data->old_guami);
|
||||
ogs_free(assign_ebi_data);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_assign_ebi_data_convertToJSON(OpenAPI_assign_ebi_data_t *assign_ebi_data)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (assign_ebi_data == NULL) {
|
||||
ogs_error("OpenAPI_assign_ebi_data_convertToJSON() failed [AssignEbiData]");
|
||||
|
|
@ -61,34 +72,28 @@ cJSON *OpenAPI_assign_ebi_data_convertToJSON(OpenAPI_assign_ebi_data_t *assign_e
|
|||
ogs_error("OpenAPI_assign_ebi_data_convertToJSON() failed [arp_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *arp_list_node;
|
||||
if (assign_ebi_data->arp_list) {
|
||||
OpenAPI_list_for_each(assign_ebi_data->arp_list, arp_list_node) {
|
||||
cJSON *itemLocal = OpenAPI_arp_convertToJSON(arp_list_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_assign_ebi_data_convertToJSON() failed [arp_list]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(arp_listList, itemLocal);
|
||||
OpenAPI_list_for_each(assign_ebi_data->arp_list, node) {
|
||||
cJSON *itemLocal = OpenAPI_arp_convertToJSON(node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_assign_ebi_data_convertToJSON() failed [arp_list]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(arp_listList, itemLocal);
|
||||
}
|
||||
}
|
||||
|
||||
if (assign_ebi_data->released_ebi_list) {
|
||||
cJSON *released_ebi_list = cJSON_AddArrayToObject(item, "releasedEbiList");
|
||||
if (released_ebi_list == NULL) {
|
||||
cJSON *released_ebi_listList = cJSON_AddArrayToObject(item, "releasedEbiList");
|
||||
if (released_ebi_listList == NULL) {
|
||||
ogs_error("OpenAPI_assign_ebi_data_convertToJSON() failed [released_ebi_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *released_ebi_list_node;
|
||||
OpenAPI_list_for_each(assign_ebi_data->released_ebi_list, released_ebi_list_node) {
|
||||
if (cJSON_AddNumberToObject(released_ebi_list, "", *(double *)released_ebi_list_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_assign_ebi_data_convertToJSON() failed [released_ebi_list]");
|
||||
goto end;
|
||||
OpenAPI_list_for_each(assign_ebi_data->released_ebi_list, node) {
|
||||
if (cJSON_AddNumberToObject(released_ebi_listList, "", (uintptr_t)node->data) == NULL) {
|
||||
ogs_error("OpenAPI_assign_ebi_data_convertToJSON() failed [released_ebi_list]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (assign_ebi_data->old_guami) {
|
||||
|
|
@ -111,69 +116,77 @@ end:
|
|||
OpenAPI_assign_ebi_data_t *OpenAPI_assign_ebi_data_parseFromJSON(cJSON *assign_ebi_dataJSON)
|
||||
{
|
||||
OpenAPI_assign_ebi_data_t *assign_ebi_data_local_var = NULL;
|
||||
cJSON *pdu_session_id = cJSON_GetObjectItemCaseSensitive(assign_ebi_dataJSON, "pduSessionId");
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *pdu_session_id = NULL;
|
||||
cJSON *arp_list = NULL;
|
||||
OpenAPI_list_t *arp_listList = NULL;
|
||||
cJSON *released_ebi_list = NULL;
|
||||
OpenAPI_list_t *released_ebi_listList = NULL;
|
||||
cJSON *old_guami = NULL;
|
||||
OpenAPI_guami_t *old_guami_local_nonprim = NULL;
|
||||
pdu_session_id = cJSON_GetObjectItemCaseSensitive(assign_ebi_dataJSON, "pduSessionId");
|
||||
if (!pdu_session_id) {
|
||||
ogs_error("OpenAPI_assign_ebi_data_parseFromJSON() failed [pdu_session_id]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!cJSON_IsNumber(pdu_session_id)) {
|
||||
ogs_error("OpenAPI_assign_ebi_data_parseFromJSON() failed [pdu_session_id]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *arp_list = cJSON_GetObjectItemCaseSensitive(assign_ebi_dataJSON, "arpList");
|
||||
|
||||
OpenAPI_list_t *arp_listList;
|
||||
arp_list = cJSON_GetObjectItemCaseSensitive(assign_ebi_dataJSON, "arpList");
|
||||
if (arp_list) {
|
||||
cJSON *arp_list_local_nonprimitive;
|
||||
if (!cJSON_IsArray(arp_list)){
|
||||
ogs_error("OpenAPI_assign_ebi_data_parseFromJSON() failed [arp_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
arp_listList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(arp_list_local_nonprimitive, arp_list ) {
|
||||
if (!cJSON_IsObject(arp_list_local_nonprimitive)) {
|
||||
cJSON *arp_list_local = NULL;
|
||||
if (!cJSON_IsArray(arp_list)) {
|
||||
ogs_error("OpenAPI_assign_ebi_data_parseFromJSON() failed [arp_list]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_arp_t *arp_listItem = OpenAPI_arp_parseFromJSON(arp_list_local_nonprimitive);
|
||||
|
||||
if (!arp_listItem) {
|
||||
ogs_error("No arp_listItem");
|
||||
OpenAPI_list_free(arp_listList);
|
||||
arp_listList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(arp_list_local, arp_list) {
|
||||
if (!cJSON_IsObject(arp_list_local)) {
|
||||
ogs_error("OpenAPI_assign_ebi_data_parseFromJSON() failed [arp_list]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_arp_t *arp_listItem = OpenAPI_arp_parseFromJSON(arp_list_local);
|
||||
if (!arp_listItem) {
|
||||
ogs_error("No arp_listItem");
|
||||
OpenAPI_list_free(arp_listList);
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(arp_listList, arp_listItem);
|
||||
}
|
||||
}
|
||||
|
||||
released_ebi_list = cJSON_GetObjectItemCaseSensitive(assign_ebi_dataJSON, "releasedEbiList");
|
||||
if (released_ebi_list) {
|
||||
cJSON *released_ebi_list_local = NULL;
|
||||
if (!cJSON_IsArray(released_ebi_list)) {
|
||||
ogs_error("OpenAPI_assign_ebi_data_parseFromJSON() failed [released_ebi_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_list_add(arp_listList, arp_listItem);
|
||||
}
|
||||
released_ebi_listList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(released_ebi_list_local, released_ebi_list) {
|
||||
double *localDouble = NULL;
|
||||
int *localInt = NULL;
|
||||
if (!cJSON_IsNumber(released_ebi_list_local)) {
|
||||
ogs_error("OpenAPI_assign_ebi_data_parseFromJSON() failed [released_ebi_list]");
|
||||
goto end;
|
||||
}
|
||||
localDouble = (double *)ogs_calloc(1, sizeof(double));
|
||||
if (!localDouble) {
|
||||
ogs_error("OpenAPI_assign_ebi_data_parseFromJSON() failed [released_ebi_list]");
|
||||
goto end;
|
||||
}
|
||||
*localDouble = released_ebi_list_local->valuedouble;
|
||||
OpenAPI_list_add(released_ebi_listList, localDouble);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *released_ebi_list = cJSON_GetObjectItemCaseSensitive(assign_ebi_dataJSON, "releasedEbiList");
|
||||
|
||||
OpenAPI_list_t *released_ebi_listList;
|
||||
if (released_ebi_list) {
|
||||
cJSON *released_ebi_list_local;
|
||||
if (!cJSON_IsArray(released_ebi_list)) {
|
||||
ogs_error("OpenAPI_assign_ebi_data_parseFromJSON() failed [released_ebi_list]");
|
||||
goto end;
|
||||
}
|
||||
released_ebi_listList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(released_ebi_list_local, released_ebi_list) {
|
||||
if (!cJSON_IsNumber(released_ebi_list_local)) {
|
||||
ogs_error("OpenAPI_assign_ebi_data_parseFromJSON() failed [released_ebi_list]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(released_ebi_listList, &released_ebi_list_local->valuedouble);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *old_guami = cJSON_GetObjectItemCaseSensitive(assign_ebi_dataJSON, "oldGuami");
|
||||
|
||||
OpenAPI_guami_t *old_guami_local_nonprim = NULL;
|
||||
old_guami = cJSON_GetObjectItemCaseSensitive(assign_ebi_dataJSON, "oldGuami");
|
||||
if (old_guami) {
|
||||
old_guami_local_nonprim = OpenAPI_guami_parseFromJSON(old_guami);
|
||||
}
|
||||
|
|
@ -188,6 +201,24 @@ OpenAPI_assign_ebi_data_t *OpenAPI_assign_ebi_data_parseFromJSON(cJSON *assign_e
|
|||
|
||||
return assign_ebi_data_local_var;
|
||||
end:
|
||||
if (arp_listList) {
|
||||
OpenAPI_list_for_each(arp_listList, node) {
|
||||
OpenAPI_arp_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(arp_listList);
|
||||
arp_listList = NULL;
|
||||
}
|
||||
if (released_ebi_listList) {
|
||||
OpenAPI_list_for_each(released_ebi_listList, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(released_ebi_listList);
|
||||
released_ebi_listList = NULL;
|
||||
}
|
||||
if (old_guami_local_nonprim) {
|
||||
OpenAPI_guami_free(old_guami_local_nonprim);
|
||||
old_guami_local_nonprim = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue