[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

@ -32,22 +32,42 @@ OpenAPI_nr_location_t *OpenAPI_nr_location_create(
void OpenAPI_nr_location_free(OpenAPI_nr_location_t *nr_location)
{
OpenAPI_lnode_t *node = NULL;
if (NULL == nr_location) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_tai_free(nr_location->tai);
OpenAPI_ncgi_free(nr_location->ncgi);
ogs_free(nr_location->ue_location_timestamp);
ogs_free(nr_location->geographical_information);
ogs_free(nr_location->geodetic_information);
OpenAPI_global_ran_node_id_free(nr_location->global_gnb_id);
if (nr_location->tai) {
OpenAPI_tai_free(nr_location->tai);
nr_location->tai = NULL;
}
if (nr_location->ncgi) {
OpenAPI_ncgi_free(nr_location->ncgi);
nr_location->ncgi = NULL;
}
if (nr_location->ue_location_timestamp) {
ogs_free(nr_location->ue_location_timestamp);
nr_location->ue_location_timestamp = NULL;
}
if (nr_location->geographical_information) {
ogs_free(nr_location->geographical_information);
nr_location->geographical_information = NULL;
}
if (nr_location->geodetic_information) {
ogs_free(nr_location->geodetic_information);
nr_location->geodetic_information = NULL;
}
if (nr_location->global_gnb_id) {
OpenAPI_global_ran_node_id_free(nr_location->global_gnb_id);
nr_location->global_gnb_id = NULL;
}
ogs_free(nr_location);
}
cJSON *OpenAPI_nr_location_convertToJSON(OpenAPI_nr_location_t *nr_location)
{
cJSON *item = NULL;
OpenAPI_lnode_t *node = NULL;
if (nr_location == NULL) {
ogs_error("OpenAPI_nr_location_convertToJSON() failed [NrLocation]");
@ -55,6 +75,10 @@ cJSON *OpenAPI_nr_location_convertToJSON(OpenAPI_nr_location_t *nr_location)
}
item = cJSON_CreateObject();
if (!nr_location->tai) {
ogs_error("OpenAPI_nr_location_convertToJSON() failed [tai]");
return NULL;
}
cJSON *tai_local_JSON = OpenAPI_tai_convertToJSON(nr_location->tai);
if (tai_local_JSON == NULL) {
ogs_error("OpenAPI_nr_location_convertToJSON() failed [tai]");
@ -66,6 +90,10 @@ cJSON *OpenAPI_nr_location_convertToJSON(OpenAPI_nr_location_t *nr_location)
goto end;
}
if (!nr_location->ncgi) {
ogs_error("OpenAPI_nr_location_convertToJSON() failed [ncgi]");
return NULL;
}
cJSON *ncgi_local_JSON = OpenAPI_ncgi_convertToJSON(nr_location->ncgi);
if (ncgi_local_JSON == NULL) {
ogs_error("OpenAPI_nr_location_convertToJSON() failed [ncgi]");
@ -125,26 +153,32 @@ end:
OpenAPI_nr_location_t *OpenAPI_nr_location_parseFromJSON(cJSON *nr_locationJSON)
{
OpenAPI_nr_location_t *nr_location_local_var = NULL;
cJSON *tai = cJSON_GetObjectItemCaseSensitive(nr_locationJSON, "tai");
OpenAPI_lnode_t *node = NULL;
cJSON *tai = NULL;
OpenAPI_tai_t *tai_local_nonprim = NULL;
cJSON *ncgi = NULL;
OpenAPI_ncgi_t *ncgi_local_nonprim = NULL;
cJSON *age_of_location_information = NULL;
cJSON *ue_location_timestamp = NULL;
cJSON *geographical_information = NULL;
cJSON *geodetic_information = NULL;
cJSON *global_gnb_id = NULL;
OpenAPI_global_ran_node_id_t *global_gnb_id_local_nonprim = NULL;
tai = cJSON_GetObjectItemCaseSensitive(nr_locationJSON, "tai");
if (!tai) {
ogs_error("OpenAPI_nr_location_parseFromJSON() failed [tai]");
goto end;
}
OpenAPI_tai_t *tai_local_nonprim = NULL;
tai_local_nonprim = OpenAPI_tai_parseFromJSON(tai);
cJSON *ncgi = cJSON_GetObjectItemCaseSensitive(nr_locationJSON, "ncgi");
ncgi = cJSON_GetObjectItemCaseSensitive(nr_locationJSON, "ncgi");
if (!ncgi) {
ogs_error("OpenAPI_nr_location_parseFromJSON() failed [ncgi]");
goto end;
}
OpenAPI_ncgi_t *ncgi_local_nonprim = NULL;
ncgi_local_nonprim = OpenAPI_ncgi_parseFromJSON(ncgi);
cJSON *age_of_location_information = cJSON_GetObjectItemCaseSensitive(nr_locationJSON, "ageOfLocationInformation");
age_of_location_information = cJSON_GetObjectItemCaseSensitive(nr_locationJSON, "ageOfLocationInformation");
if (age_of_location_information) {
if (!cJSON_IsNumber(age_of_location_information)) {
ogs_error("OpenAPI_nr_location_parseFromJSON() failed [age_of_location_information]");
@ -152,36 +186,31 @@ OpenAPI_nr_location_t *OpenAPI_nr_location_parseFromJSON(cJSON *nr_locationJSON)
}
}
cJSON *ue_location_timestamp = cJSON_GetObjectItemCaseSensitive(nr_locationJSON, "ueLocationTimestamp");
ue_location_timestamp = cJSON_GetObjectItemCaseSensitive(nr_locationJSON, "ueLocationTimestamp");
if (ue_location_timestamp) {
if (!cJSON_IsString(ue_location_timestamp)) {
if (!cJSON_IsString(ue_location_timestamp) && !cJSON_IsNull(ue_location_timestamp)) {
ogs_error("OpenAPI_nr_location_parseFromJSON() failed [ue_location_timestamp]");
goto end;
}
}
cJSON *geographical_information = cJSON_GetObjectItemCaseSensitive(nr_locationJSON, "geographicalInformation");
geographical_information = cJSON_GetObjectItemCaseSensitive(nr_locationJSON, "geographicalInformation");
if (geographical_information) {
if (!cJSON_IsString(geographical_information)) {
if (!cJSON_IsString(geographical_information) && !cJSON_IsNull(geographical_information)) {
ogs_error("OpenAPI_nr_location_parseFromJSON() failed [geographical_information]");
goto end;
}
}
cJSON *geodetic_information = cJSON_GetObjectItemCaseSensitive(nr_locationJSON, "geodeticInformation");
geodetic_information = cJSON_GetObjectItemCaseSensitive(nr_locationJSON, "geodeticInformation");
if (geodetic_information) {
if (!cJSON_IsString(geodetic_information)) {
if (!cJSON_IsString(geodetic_information) && !cJSON_IsNull(geodetic_information)) {
ogs_error("OpenAPI_nr_location_parseFromJSON() failed [geodetic_information]");
goto end;
}
}
cJSON *global_gnb_id = cJSON_GetObjectItemCaseSensitive(nr_locationJSON, "globalGnbId");
OpenAPI_global_ran_node_id_t *global_gnb_id_local_nonprim = NULL;
global_gnb_id = cJSON_GetObjectItemCaseSensitive(nr_locationJSON, "globalGnbId");
if (global_gnb_id) {
global_gnb_id_local_nonprim = OpenAPI_global_ran_node_id_parseFromJSON(global_gnb_id);
}
@ -191,14 +220,26 @@ OpenAPI_nr_location_t *OpenAPI_nr_location_parseFromJSON(cJSON *nr_locationJSON)
ncgi_local_nonprim,
age_of_location_information ? true : false,
age_of_location_information ? age_of_location_information->valuedouble : 0,
ue_location_timestamp ? ogs_strdup(ue_location_timestamp->valuestring) : NULL,
geographical_information ? ogs_strdup(geographical_information->valuestring) : NULL,
geodetic_information ? ogs_strdup(geodetic_information->valuestring) : NULL,
ue_location_timestamp && !cJSON_IsNull(ue_location_timestamp) ? ogs_strdup(ue_location_timestamp->valuestring) : NULL,
geographical_information && !cJSON_IsNull(geographical_information) ? ogs_strdup(geographical_information->valuestring) : NULL,
geodetic_information && !cJSON_IsNull(geodetic_information) ? ogs_strdup(geodetic_information->valuestring) : NULL,
global_gnb_id ? global_gnb_id_local_nonprim : NULL
);
return nr_location_local_var;
end:
if (tai_local_nonprim) {
OpenAPI_tai_free(tai_local_nonprim);
tai_local_nonprim = NULL;
}
if (ncgi_local_nonprim) {
OpenAPI_ncgi_free(ncgi_local_nonprim);
ncgi_local_nonprim = NULL;
}
if (global_gnb_id_local_nonprim) {
OpenAPI_global_ran_node_id_free(global_gnb_id_local_nonprim);
global_gnb_id_local_nonprim = NULL;
}
return NULL;
}