[SBI] Crash occurs when ENUM in the MAP (#2103)

This commit is contained in:
Sukchan Lee 2023-03-01 17:50:25 +09:00
parent ce668c556c
commit 969c116e77
1097 changed files with 266728 additions and 42047 deletions

View file

@ -30,22 +30,33 @@ OpenAPI_pws_information_t *OpenAPI_pws_information_create(
void OpenAPI_pws_information_free(OpenAPI_pws_information_t *pws_information)
{
OpenAPI_lnode_t *node = NULL;
if (NULL == pws_information) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_n2_info_content_free(pws_information->pws_container);
OpenAPI_list_for_each(pws_information->bc_empty_area_list, node) {
OpenAPI_global_ran_node_id_free(node->data);
if (pws_information->pws_container) {
OpenAPI_n2_info_content_free(pws_information->pws_container);
pws_information->pws_container = NULL;
}
if (pws_information->bc_empty_area_list) {
OpenAPI_list_for_each(pws_information->bc_empty_area_list, node) {
OpenAPI_global_ran_node_id_free(node->data);
}
OpenAPI_list_free(pws_information->bc_empty_area_list);
pws_information->bc_empty_area_list = NULL;
}
if (pws_information->omc_id) {
ogs_free(pws_information->omc_id);
pws_information->omc_id = NULL;
}
OpenAPI_list_free(pws_information->bc_empty_area_list);
ogs_free(pws_information->omc_id);
ogs_free(pws_information);
}
cJSON *OpenAPI_pws_information_convertToJSON(OpenAPI_pws_information_t *pws_information)
{
cJSON *item = NULL;
OpenAPI_lnode_t *node = NULL;
if (pws_information == NULL) {
ogs_error("OpenAPI_pws_information_convertToJSON() failed [PwsInformation]");
@ -63,6 +74,10 @@ cJSON *OpenAPI_pws_information_convertToJSON(OpenAPI_pws_information_t *pws_info
goto end;
}
if (!pws_information->pws_container) {
ogs_error("OpenAPI_pws_information_convertToJSON() failed [pws_container]");
return NULL;
}
cJSON *pws_container_local_JSON = OpenAPI_n2_info_content_convertToJSON(pws_information->pws_container);
if (pws_container_local_JSON == NULL) {
ogs_error("OpenAPI_pws_information_convertToJSON() failed [pws_container]");
@ -80,17 +95,13 @@ cJSON *OpenAPI_pws_information_convertToJSON(OpenAPI_pws_information_t *pws_info
ogs_error("OpenAPI_pws_information_convertToJSON() failed [bc_empty_area_list]");
goto end;
}
OpenAPI_lnode_t *bc_empty_area_list_node;
if (pws_information->bc_empty_area_list) {
OpenAPI_list_for_each(pws_information->bc_empty_area_list, bc_empty_area_list_node) {
cJSON *itemLocal = OpenAPI_global_ran_node_id_convertToJSON(bc_empty_area_list_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_pws_information_convertToJSON() failed [bc_empty_area_list]");
goto end;
}
cJSON_AddItemToArray(bc_empty_area_listList, itemLocal);
OpenAPI_list_for_each(pws_information->bc_empty_area_list, node) {
cJSON *itemLocal = OpenAPI_global_ran_node_id_convertToJSON(node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_pws_information_convertToJSON() failed [bc_empty_area_list]");
goto end;
}
cJSON_AddItemToArray(bc_empty_area_listList, itemLocal);
}
}
@ -115,68 +126,68 @@ end:
OpenAPI_pws_information_t *OpenAPI_pws_information_parseFromJSON(cJSON *pws_informationJSON)
{
OpenAPI_pws_information_t *pws_information_local_var = NULL;
cJSON *message_identifier = cJSON_GetObjectItemCaseSensitive(pws_informationJSON, "messageIdentifier");
OpenAPI_lnode_t *node = NULL;
cJSON *message_identifier = NULL;
cJSON *serial_number = NULL;
cJSON *pws_container = NULL;
OpenAPI_n2_info_content_t *pws_container_local_nonprim = NULL;
cJSON *bc_empty_area_list = NULL;
OpenAPI_list_t *bc_empty_area_listList = NULL;
cJSON *send_ran_response = NULL;
cJSON *omc_id = NULL;
message_identifier = cJSON_GetObjectItemCaseSensitive(pws_informationJSON, "messageIdentifier");
if (!message_identifier) {
ogs_error("OpenAPI_pws_information_parseFromJSON() failed [message_identifier]");
goto end;
}
if (!cJSON_IsNumber(message_identifier)) {
ogs_error("OpenAPI_pws_information_parseFromJSON() failed [message_identifier]");
goto end;
}
cJSON *serial_number = cJSON_GetObjectItemCaseSensitive(pws_informationJSON, "serialNumber");
serial_number = cJSON_GetObjectItemCaseSensitive(pws_informationJSON, "serialNumber");
if (!serial_number) {
ogs_error("OpenAPI_pws_information_parseFromJSON() failed [serial_number]");
goto end;
}
if (!cJSON_IsNumber(serial_number)) {
ogs_error("OpenAPI_pws_information_parseFromJSON() failed [serial_number]");
goto end;
}
cJSON *pws_container = cJSON_GetObjectItemCaseSensitive(pws_informationJSON, "pwsContainer");
pws_container = cJSON_GetObjectItemCaseSensitive(pws_informationJSON, "pwsContainer");
if (!pws_container) {
ogs_error("OpenAPI_pws_information_parseFromJSON() failed [pws_container]");
goto end;
}
OpenAPI_n2_info_content_t *pws_container_local_nonprim = NULL;
pws_container_local_nonprim = OpenAPI_n2_info_content_parseFromJSON(pws_container);
cJSON *bc_empty_area_list = cJSON_GetObjectItemCaseSensitive(pws_informationJSON, "bcEmptyAreaList");
OpenAPI_list_t *bc_empty_area_listList;
bc_empty_area_list = cJSON_GetObjectItemCaseSensitive(pws_informationJSON, "bcEmptyAreaList");
if (bc_empty_area_list) {
cJSON *bc_empty_area_list_local_nonprimitive;
if (!cJSON_IsArray(bc_empty_area_list)){
ogs_error("OpenAPI_pws_information_parseFromJSON() failed [bc_empty_area_list]");
goto end;
}
bc_empty_area_listList = OpenAPI_list_create();
cJSON_ArrayForEach(bc_empty_area_list_local_nonprimitive, bc_empty_area_list ) {
if (!cJSON_IsObject(bc_empty_area_list_local_nonprimitive)) {
cJSON *bc_empty_area_list_local = NULL;
if (!cJSON_IsArray(bc_empty_area_list)) {
ogs_error("OpenAPI_pws_information_parseFromJSON() failed [bc_empty_area_list]");
goto end;
}
OpenAPI_global_ran_node_id_t *bc_empty_area_listItem = OpenAPI_global_ran_node_id_parseFromJSON(bc_empty_area_list_local_nonprimitive);
if (!bc_empty_area_listItem) {
ogs_error("No bc_empty_area_listItem");
OpenAPI_list_free(bc_empty_area_listList);
goto end;
bc_empty_area_listList = OpenAPI_list_create();
cJSON_ArrayForEach(bc_empty_area_list_local, bc_empty_area_list) {
if (!cJSON_IsObject(bc_empty_area_list_local)) {
ogs_error("OpenAPI_pws_information_parseFromJSON() failed [bc_empty_area_list]");
goto end;
}
OpenAPI_global_ran_node_id_t *bc_empty_area_listItem = OpenAPI_global_ran_node_id_parseFromJSON(bc_empty_area_list_local);
if (!bc_empty_area_listItem) {
ogs_error("No bc_empty_area_listItem");
OpenAPI_list_free(bc_empty_area_listList);
goto end;
}
OpenAPI_list_add(bc_empty_area_listList, bc_empty_area_listItem);
}
OpenAPI_list_add(bc_empty_area_listList, bc_empty_area_listItem);
}
}
cJSON *send_ran_response = cJSON_GetObjectItemCaseSensitive(pws_informationJSON, "sendRanResponse");
send_ran_response = cJSON_GetObjectItemCaseSensitive(pws_informationJSON, "sendRanResponse");
if (send_ran_response) {
if (!cJSON_IsBool(send_ran_response)) {
ogs_error("OpenAPI_pws_information_parseFromJSON() failed [send_ran_response]");
@ -184,10 +195,9 @@ OpenAPI_pws_information_t *OpenAPI_pws_information_parseFromJSON(cJSON *pws_info
}
}
cJSON *omc_id = cJSON_GetObjectItemCaseSensitive(pws_informationJSON, "omcId");
omc_id = cJSON_GetObjectItemCaseSensitive(pws_informationJSON, "omcId");
if (omc_id) {
if (!cJSON_IsString(omc_id)) {
if (!cJSON_IsString(omc_id) && !cJSON_IsNull(omc_id)) {
ogs_error("OpenAPI_pws_information_parseFromJSON() failed [omc_id]");
goto end;
}
@ -202,11 +212,22 @@ OpenAPI_pws_information_t *OpenAPI_pws_information_parseFromJSON(cJSON *pws_info
bc_empty_area_list ? bc_empty_area_listList : NULL,
send_ran_response ? true : false,
send_ran_response ? send_ran_response->valueint : 0,
omc_id ? ogs_strdup(omc_id->valuestring) : NULL
omc_id && !cJSON_IsNull(omc_id) ? ogs_strdup(omc_id->valuestring) : NULL
);
return pws_information_local_var;
end:
if (pws_container_local_nonprim) {
OpenAPI_n2_info_content_free(pws_container_local_nonprim);
pws_container_local_nonprim = NULL;
}
if (bc_empty_area_listList) {
OpenAPI_list_for_each(bc_empty_area_listList, node) {
OpenAPI_global_ran_node_id_free(node->data);
}
OpenAPI_list_free(bc_empty_area_listList);
bc_empty_area_listList = NULL;
}
return NULL;
}