mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-05 15:24:14 +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
|
|
@ -28,20 +28,25 @@ OpenAPI_service_area_restriction_t *OpenAPI_service_area_restriction_create(
|
|||
|
||||
void OpenAPI_service_area_restriction_free(OpenAPI_service_area_restriction_t *service_area_restriction)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == service_area_restriction) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_list_for_each(service_area_restriction->areas, node) {
|
||||
OpenAPI_area_free(node->data);
|
||||
if (service_area_restriction->areas) {
|
||||
OpenAPI_list_for_each(service_area_restriction->areas, node) {
|
||||
OpenAPI_area_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(service_area_restriction->areas);
|
||||
service_area_restriction->areas = NULL;
|
||||
}
|
||||
OpenAPI_list_free(service_area_restriction->areas);
|
||||
ogs_free(service_area_restriction);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_service_area_restriction_convertToJSON(OpenAPI_service_area_restriction_t *service_area_restriction)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (service_area_restriction == NULL) {
|
||||
ogs_error("OpenAPI_service_area_restriction_convertToJSON() failed [ServiceAreaRestriction]");
|
||||
|
|
@ -49,7 +54,7 @@ cJSON *OpenAPI_service_area_restriction_convertToJSON(OpenAPI_service_area_restr
|
|||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (service_area_restriction->restriction_type) {
|
||||
if (service_area_restriction->restriction_type != OpenAPI_restriction_type_NULL) {
|
||||
if (cJSON_AddStringToObject(item, "restrictionType", OpenAPI_restriction_type_ToString(service_area_restriction->restriction_type)) == NULL) {
|
||||
ogs_error("OpenAPI_service_area_restriction_convertToJSON() failed [restriction_type]");
|
||||
goto end;
|
||||
|
|
@ -62,17 +67,13 @@ cJSON *OpenAPI_service_area_restriction_convertToJSON(OpenAPI_service_area_restr
|
|||
ogs_error("OpenAPI_service_area_restriction_convertToJSON() failed [areas]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *areas_node;
|
||||
if (service_area_restriction->areas) {
|
||||
OpenAPI_list_for_each(service_area_restriction->areas, areas_node) {
|
||||
cJSON *itemLocal = OpenAPI_area_convertToJSON(areas_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_service_area_restriction_convertToJSON() failed [areas]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(areasList, itemLocal);
|
||||
OpenAPI_list_for_each(service_area_restriction->areas, node) {
|
||||
cJSON *itemLocal = OpenAPI_area_convertToJSON(node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_service_area_restriction_convertToJSON() failed [areas]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(areasList, itemLocal);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -97,9 +98,14 @@ end:
|
|||
OpenAPI_service_area_restriction_t *OpenAPI_service_area_restriction_parseFromJSON(cJSON *service_area_restrictionJSON)
|
||||
{
|
||||
OpenAPI_service_area_restriction_t *service_area_restriction_local_var = NULL;
|
||||
cJSON *restriction_type = cJSON_GetObjectItemCaseSensitive(service_area_restrictionJSON, "restrictionType");
|
||||
|
||||
OpenAPI_restriction_type_e restriction_typeVariable;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *restriction_type = NULL;
|
||||
OpenAPI_restriction_type_e restriction_typeVariable = 0;
|
||||
cJSON *areas = NULL;
|
||||
OpenAPI_list_t *areasList = NULL;
|
||||
cJSON *max_num_of_tas = NULL;
|
||||
cJSON *max_num_of_tas_for_not_allowed_areas = NULL;
|
||||
restriction_type = cJSON_GetObjectItemCaseSensitive(service_area_restrictionJSON, "restrictionType");
|
||||
if (restriction_type) {
|
||||
if (!cJSON_IsString(restriction_type)) {
|
||||
ogs_error("OpenAPI_service_area_restriction_parseFromJSON() failed [restriction_type]");
|
||||
|
|
@ -108,37 +114,32 @@ OpenAPI_service_area_restriction_t *OpenAPI_service_area_restriction_parseFromJS
|
|||
restriction_typeVariable = OpenAPI_restriction_type_FromString(restriction_type->valuestring);
|
||||
}
|
||||
|
||||
cJSON *areas = cJSON_GetObjectItemCaseSensitive(service_area_restrictionJSON, "areas");
|
||||
|
||||
OpenAPI_list_t *areasList;
|
||||
areas = cJSON_GetObjectItemCaseSensitive(service_area_restrictionJSON, "areas");
|
||||
if (areas) {
|
||||
cJSON *areas_local_nonprimitive;
|
||||
if (!cJSON_IsArray(areas)){
|
||||
ogs_error("OpenAPI_service_area_restriction_parseFromJSON() failed [areas]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
areasList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(areas_local_nonprimitive, areas ) {
|
||||
if (!cJSON_IsObject(areas_local_nonprimitive)) {
|
||||
cJSON *areas_local = NULL;
|
||||
if (!cJSON_IsArray(areas)) {
|
||||
ogs_error("OpenAPI_service_area_restriction_parseFromJSON() failed [areas]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_area_t *areasItem = OpenAPI_area_parseFromJSON(areas_local_nonprimitive);
|
||||
|
||||
if (!areasItem) {
|
||||
ogs_error("No areasItem");
|
||||
OpenAPI_list_free(areasList);
|
||||
goto end;
|
||||
areasList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(areas_local, areas) {
|
||||
if (!cJSON_IsObject(areas_local)) {
|
||||
ogs_error("OpenAPI_service_area_restriction_parseFromJSON() failed [areas]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_area_t *areasItem = OpenAPI_area_parseFromJSON(areas_local);
|
||||
if (!areasItem) {
|
||||
ogs_error("No areasItem");
|
||||
OpenAPI_list_free(areasList);
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(areasList, areasItem);
|
||||
}
|
||||
|
||||
OpenAPI_list_add(areasList, areasItem);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *max_num_of_tas = cJSON_GetObjectItemCaseSensitive(service_area_restrictionJSON, "maxNumOfTAs");
|
||||
|
||||
max_num_of_tas = cJSON_GetObjectItemCaseSensitive(service_area_restrictionJSON, "maxNumOfTAs");
|
||||
if (max_num_of_tas) {
|
||||
if (!cJSON_IsNumber(max_num_of_tas)) {
|
||||
ogs_error("OpenAPI_service_area_restriction_parseFromJSON() failed [max_num_of_tas]");
|
||||
|
|
@ -146,8 +147,7 @@ OpenAPI_service_area_restriction_t *OpenAPI_service_area_restriction_parseFromJS
|
|||
}
|
||||
}
|
||||
|
||||
cJSON *max_num_of_tas_for_not_allowed_areas = cJSON_GetObjectItemCaseSensitive(service_area_restrictionJSON, "maxNumOfTAsForNotAllowedAreas");
|
||||
|
||||
max_num_of_tas_for_not_allowed_areas = cJSON_GetObjectItemCaseSensitive(service_area_restrictionJSON, "maxNumOfTAsForNotAllowedAreas");
|
||||
if (max_num_of_tas_for_not_allowed_areas) {
|
||||
if (!cJSON_IsNumber(max_num_of_tas_for_not_allowed_areas)) {
|
||||
ogs_error("OpenAPI_service_area_restriction_parseFromJSON() failed [max_num_of_tas_for_not_allowed_areas]");
|
||||
|
|
@ -166,6 +166,13 @@ OpenAPI_service_area_restriction_t *OpenAPI_service_area_restriction_parseFromJS
|
|||
|
||||
return service_area_restriction_local_var;
|
||||
end:
|
||||
if (areasList) {
|
||||
OpenAPI_list_for_each(areasList, node) {
|
||||
OpenAPI_area_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(areasList);
|
||||
areasList = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue