[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

@ -42,23 +42,46 @@ OpenAPI_eutra_location_t *OpenAPI_eutra_location_create(
void OpenAPI_eutra_location_free(OpenAPI_eutra_location_t *eutra_location)
{
OpenAPI_lnode_t *node = NULL;
if (NULL == eutra_location) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_tai_free(eutra_location->tai);
OpenAPI_ecgi_free(eutra_location->ecgi);
ogs_free(eutra_location->ue_location_timestamp);
ogs_free(eutra_location->geographical_information);
ogs_free(eutra_location->geodetic_information);
OpenAPI_global_ran_node_id_free(eutra_location->global_ngenb_id);
OpenAPI_global_ran_node_id_free(eutra_location->global_enb_id);
if (eutra_location->tai) {
OpenAPI_tai_free(eutra_location->tai);
eutra_location->tai = NULL;
}
if (eutra_location->ecgi) {
OpenAPI_ecgi_free(eutra_location->ecgi);
eutra_location->ecgi = NULL;
}
if (eutra_location->ue_location_timestamp) {
ogs_free(eutra_location->ue_location_timestamp);
eutra_location->ue_location_timestamp = NULL;
}
if (eutra_location->geographical_information) {
ogs_free(eutra_location->geographical_information);
eutra_location->geographical_information = NULL;
}
if (eutra_location->geodetic_information) {
ogs_free(eutra_location->geodetic_information);
eutra_location->geodetic_information = NULL;
}
if (eutra_location->global_ngenb_id) {
OpenAPI_global_ran_node_id_free(eutra_location->global_ngenb_id);
eutra_location->global_ngenb_id = NULL;
}
if (eutra_location->global_enb_id) {
OpenAPI_global_ran_node_id_free(eutra_location->global_enb_id);
eutra_location->global_enb_id = NULL;
}
ogs_free(eutra_location);
}
cJSON *OpenAPI_eutra_location_convertToJSON(OpenAPI_eutra_location_t *eutra_location)
{
cJSON *item = NULL;
OpenAPI_lnode_t *node = NULL;
if (eutra_location == NULL) {
ogs_error("OpenAPI_eutra_location_convertToJSON() failed [EutraLocation]");
@ -66,6 +89,10 @@ cJSON *OpenAPI_eutra_location_convertToJSON(OpenAPI_eutra_location_t *eutra_loca
}
item = cJSON_CreateObject();
if (!eutra_location->tai) {
ogs_error("OpenAPI_eutra_location_convertToJSON() failed [tai]");
return NULL;
}
cJSON *tai_local_JSON = OpenAPI_tai_convertToJSON(eutra_location->tai);
if (tai_local_JSON == NULL) {
ogs_error("OpenAPI_eutra_location_convertToJSON() failed [tai]");
@ -84,6 +111,10 @@ cJSON *OpenAPI_eutra_location_convertToJSON(OpenAPI_eutra_location_t *eutra_loca
}
}
if (!eutra_location->ecgi) {
ogs_error("OpenAPI_eutra_location_convertToJSON() failed [ecgi]");
return NULL;
}
cJSON *ecgi_local_JSON = OpenAPI_ecgi_convertToJSON(eutra_location->ecgi);
if (ecgi_local_JSON == NULL) {
ogs_error("OpenAPI_eutra_location_convertToJSON() failed [ecgi]");
@ -163,17 +194,29 @@ end:
OpenAPI_eutra_location_t *OpenAPI_eutra_location_parseFromJSON(cJSON *eutra_locationJSON)
{
OpenAPI_eutra_location_t *eutra_location_local_var = NULL;
cJSON *tai = cJSON_GetObjectItemCaseSensitive(eutra_locationJSON, "tai");
OpenAPI_lnode_t *node = NULL;
cJSON *tai = NULL;
OpenAPI_tai_t *tai_local_nonprim = NULL;
cJSON *ignore_tai = NULL;
cJSON *ecgi = NULL;
OpenAPI_ecgi_t *ecgi_local_nonprim = NULL;
cJSON *ignore_ecgi = NULL;
cJSON *age_of_location_information = NULL;
cJSON *ue_location_timestamp = NULL;
cJSON *geographical_information = NULL;
cJSON *geodetic_information = NULL;
cJSON *global_ngenb_id = NULL;
OpenAPI_global_ran_node_id_t *global_ngenb_id_local_nonprim = NULL;
cJSON *global_enb_id = NULL;
OpenAPI_global_ran_node_id_t *global_enb_id_local_nonprim = NULL;
tai = cJSON_GetObjectItemCaseSensitive(eutra_locationJSON, "tai");
if (!tai) {
ogs_error("OpenAPI_eutra_location_parseFromJSON() failed [tai]");
goto end;
}
OpenAPI_tai_t *tai_local_nonprim = NULL;
tai_local_nonprim = OpenAPI_tai_parseFromJSON(tai);
cJSON *ignore_tai = cJSON_GetObjectItemCaseSensitive(eutra_locationJSON, "ignoreTai");
ignore_tai = cJSON_GetObjectItemCaseSensitive(eutra_locationJSON, "ignoreTai");
if (ignore_tai) {
if (!cJSON_IsBool(ignore_tai)) {
ogs_error("OpenAPI_eutra_location_parseFromJSON() failed [ignore_tai]");
@ -181,17 +224,14 @@ OpenAPI_eutra_location_t *OpenAPI_eutra_location_parseFromJSON(cJSON *eutra_loca
}
}
cJSON *ecgi = cJSON_GetObjectItemCaseSensitive(eutra_locationJSON, "ecgi");
ecgi = cJSON_GetObjectItemCaseSensitive(eutra_locationJSON, "ecgi");
if (!ecgi) {
ogs_error("OpenAPI_eutra_location_parseFromJSON() failed [ecgi]");
goto end;
}
OpenAPI_ecgi_t *ecgi_local_nonprim = NULL;
ecgi_local_nonprim = OpenAPI_ecgi_parseFromJSON(ecgi);
cJSON *ignore_ecgi = cJSON_GetObjectItemCaseSensitive(eutra_locationJSON, "ignoreEcgi");
ignore_ecgi = cJSON_GetObjectItemCaseSensitive(eutra_locationJSON, "ignoreEcgi");
if (ignore_ecgi) {
if (!cJSON_IsBool(ignore_ecgi)) {
ogs_error("OpenAPI_eutra_location_parseFromJSON() failed [ignore_ecgi]");
@ -199,8 +239,7 @@ OpenAPI_eutra_location_t *OpenAPI_eutra_location_parseFromJSON(cJSON *eutra_loca
}
}
cJSON *age_of_location_information = cJSON_GetObjectItemCaseSensitive(eutra_locationJSON, "ageOfLocationInformation");
age_of_location_information = cJSON_GetObjectItemCaseSensitive(eutra_locationJSON, "ageOfLocationInformation");
if (age_of_location_information) {
if (!cJSON_IsNumber(age_of_location_information)) {
ogs_error("OpenAPI_eutra_location_parseFromJSON() failed [age_of_location_information]");
@ -208,43 +247,36 @@ OpenAPI_eutra_location_t *OpenAPI_eutra_location_parseFromJSON(cJSON *eutra_loca
}
}
cJSON *ue_location_timestamp = cJSON_GetObjectItemCaseSensitive(eutra_locationJSON, "ueLocationTimestamp");
ue_location_timestamp = cJSON_GetObjectItemCaseSensitive(eutra_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_eutra_location_parseFromJSON() failed [ue_location_timestamp]");
goto end;
}
}
cJSON *geographical_information = cJSON_GetObjectItemCaseSensitive(eutra_locationJSON, "geographicalInformation");
geographical_information = cJSON_GetObjectItemCaseSensitive(eutra_locationJSON, "geographicalInformation");
if (geographical_information) {
if (!cJSON_IsString(geographical_information)) {
if (!cJSON_IsString(geographical_information) && !cJSON_IsNull(geographical_information)) {
ogs_error("OpenAPI_eutra_location_parseFromJSON() failed [geographical_information]");
goto end;
}
}
cJSON *geodetic_information = cJSON_GetObjectItemCaseSensitive(eutra_locationJSON, "geodeticInformation");
geodetic_information = cJSON_GetObjectItemCaseSensitive(eutra_locationJSON, "geodeticInformation");
if (geodetic_information) {
if (!cJSON_IsString(geodetic_information)) {
if (!cJSON_IsString(geodetic_information) && !cJSON_IsNull(geodetic_information)) {
ogs_error("OpenAPI_eutra_location_parseFromJSON() failed [geodetic_information]");
goto end;
}
}
cJSON *global_ngenb_id = cJSON_GetObjectItemCaseSensitive(eutra_locationJSON, "globalNgenbId");
OpenAPI_global_ran_node_id_t *global_ngenb_id_local_nonprim = NULL;
global_ngenb_id = cJSON_GetObjectItemCaseSensitive(eutra_locationJSON, "globalNgenbId");
if (global_ngenb_id) {
global_ngenb_id_local_nonprim = OpenAPI_global_ran_node_id_parseFromJSON(global_ngenb_id);
}
cJSON *global_enb_id = cJSON_GetObjectItemCaseSensitive(eutra_locationJSON, "globalENbId");
OpenAPI_global_ran_node_id_t *global_enb_id_local_nonprim = NULL;
global_enb_id = cJSON_GetObjectItemCaseSensitive(eutra_locationJSON, "globalENbId");
if (global_enb_id) {
global_enb_id_local_nonprim = OpenAPI_global_ran_node_id_parseFromJSON(global_enb_id);
}
@ -258,15 +290,31 @@ OpenAPI_eutra_location_t *OpenAPI_eutra_location_parseFromJSON(cJSON *eutra_loca
ignore_ecgi ? ignore_ecgi->valueint : 0,
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_ngenb_id ? global_ngenb_id_local_nonprim : NULL,
global_enb_id ? global_enb_id_local_nonprim : NULL
);
return eutra_location_local_var;
end:
if (tai_local_nonprim) {
OpenAPI_tai_free(tai_local_nonprim);
tai_local_nonprim = NULL;
}
if (ecgi_local_nonprim) {
OpenAPI_ecgi_free(ecgi_local_nonprim);
ecgi_local_nonprim = NULL;
}
if (global_ngenb_id_local_nonprim) {
OpenAPI_global_ran_node_id_free(global_ngenb_id_local_nonprim);
global_ngenb_id_local_nonprim = NULL;
}
if (global_enb_id_local_nonprim) {
OpenAPI_global_ran_node_id_free(global_enb_id_local_nonprim);
global_enb_id_local_nonprim = NULL;
}
return NULL;
}