[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,21 +42,38 @@ OpenAPI_sm_context_release_data_t *OpenAPI_sm_context_release_data_create(
void OpenAPI_sm_context_release_data_free(OpenAPI_sm_context_release_data_t *sm_context_release_data)
{
OpenAPI_lnode_t *node = NULL;
if (NULL == sm_context_release_data) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_ng_ap_cause_free(sm_context_release_data->ng_ap_cause);
OpenAPI_user_location_free(sm_context_release_data->ue_location);
ogs_free(sm_context_release_data->ue_time_zone);
OpenAPI_user_location_free(sm_context_release_data->add_ue_location);
OpenAPI_ref_to_binary_data_free(sm_context_release_data->n2_sm_info);
if (sm_context_release_data->ng_ap_cause) {
OpenAPI_ng_ap_cause_free(sm_context_release_data->ng_ap_cause);
sm_context_release_data->ng_ap_cause = NULL;
}
if (sm_context_release_data->ue_location) {
OpenAPI_user_location_free(sm_context_release_data->ue_location);
sm_context_release_data->ue_location = NULL;
}
if (sm_context_release_data->ue_time_zone) {
ogs_free(sm_context_release_data->ue_time_zone);
sm_context_release_data->ue_time_zone = NULL;
}
if (sm_context_release_data->add_ue_location) {
OpenAPI_user_location_free(sm_context_release_data->add_ue_location);
sm_context_release_data->add_ue_location = NULL;
}
if (sm_context_release_data->n2_sm_info) {
OpenAPI_ref_to_binary_data_free(sm_context_release_data->n2_sm_info);
sm_context_release_data->n2_sm_info = NULL;
}
ogs_free(sm_context_release_data);
}
cJSON *OpenAPI_sm_context_release_data_convertToJSON(OpenAPI_sm_context_release_data_t *sm_context_release_data)
{
cJSON *item = NULL;
OpenAPI_lnode_t *node = NULL;
if (sm_context_release_data == NULL) {
ogs_error("OpenAPI_sm_context_release_data_convertToJSON() failed [SmContextReleaseData]");
@ -64,7 +81,7 @@ cJSON *OpenAPI_sm_context_release_data_convertToJSON(OpenAPI_sm_context_release_
}
item = cJSON_CreateObject();
if (sm_context_release_data->cause) {
if (sm_context_release_data->cause != OpenAPI_cause_NULL) {
if (cJSON_AddStringToObject(item, "cause", OpenAPI_cause_ToString(sm_context_release_data->cause)) == NULL) {
ogs_error("OpenAPI_sm_context_release_data_convertToJSON() failed [cause]");
goto end;
@ -144,7 +161,7 @@ cJSON *OpenAPI_sm_context_release_data_convertToJSON(OpenAPI_sm_context_release_
}
}
if (sm_context_release_data->n2_sm_info_type) {
if (sm_context_release_data->n2_sm_info_type != OpenAPI_n2_sm_info_type_NULL) {
if (cJSON_AddStringToObject(item, "n2SmInfoType", OpenAPI_n2_sm_info_type_ToString(sm_context_release_data->n2_sm_info_type)) == NULL) {
ogs_error("OpenAPI_sm_context_release_data_convertToJSON() failed [n2_sm_info_type]");
goto end;
@ -165,9 +182,24 @@ end:
OpenAPI_sm_context_release_data_t *OpenAPI_sm_context_release_data_parseFromJSON(cJSON *sm_context_release_dataJSON)
{
OpenAPI_sm_context_release_data_t *sm_context_release_data_local_var = NULL;
cJSON *cause = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "cause");
OpenAPI_cause_e causeVariable;
OpenAPI_lnode_t *node = NULL;
cJSON *cause = NULL;
OpenAPI_cause_e causeVariable = 0;
cJSON *ng_ap_cause = NULL;
OpenAPI_ng_ap_cause_t *ng_ap_cause_local_nonprim = NULL;
cJSON *_5g_mm_cause_value = NULL;
cJSON *ue_location = NULL;
OpenAPI_user_location_t *ue_location_local_nonprim = NULL;
cJSON *ue_time_zone = NULL;
cJSON *add_ue_location = NULL;
OpenAPI_user_location_t *add_ue_location_local_nonprim = NULL;
cJSON *vsmf_release_only = NULL;
cJSON *n2_sm_info = NULL;
OpenAPI_ref_to_binary_data_t *n2_sm_info_local_nonprim = NULL;
cJSON *n2_sm_info_type = NULL;
OpenAPI_n2_sm_info_type_e n2_sm_info_typeVariable = 0;
cJSON *ismf_release_only = NULL;
cause = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "cause");
if (cause) {
if (!cJSON_IsString(cause)) {
ogs_error("OpenAPI_sm_context_release_data_parseFromJSON() failed [cause]");
@ -176,15 +208,12 @@ OpenAPI_sm_context_release_data_t *OpenAPI_sm_context_release_data_parseFromJSON
causeVariable = OpenAPI_cause_FromString(cause->valuestring);
}
cJSON *ng_ap_cause = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "ngApCause");
OpenAPI_ng_ap_cause_t *ng_ap_cause_local_nonprim = NULL;
ng_ap_cause = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "ngApCause");
if (ng_ap_cause) {
ng_ap_cause_local_nonprim = OpenAPI_ng_ap_cause_parseFromJSON(ng_ap_cause);
}
cJSON *_5g_mm_cause_value = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "5gMmCauseValue");
_5g_mm_cause_value = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "5gMmCauseValue");
if (_5g_mm_cause_value) {
if (!cJSON_IsNumber(_5g_mm_cause_value)) {
ogs_error("OpenAPI_sm_context_release_data_parseFromJSON() failed [_5g_mm_cause_value]");
@ -192,31 +221,25 @@ OpenAPI_sm_context_release_data_t *OpenAPI_sm_context_release_data_parseFromJSON
}
}
cJSON *ue_location = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "ueLocation");
OpenAPI_user_location_t *ue_location_local_nonprim = NULL;
ue_location = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "ueLocation");
if (ue_location) {
ue_location_local_nonprim = OpenAPI_user_location_parseFromJSON(ue_location);
}
cJSON *ue_time_zone = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "ueTimeZone");
ue_time_zone = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "ueTimeZone");
if (ue_time_zone) {
if (!cJSON_IsString(ue_time_zone)) {
if (!cJSON_IsString(ue_time_zone) && !cJSON_IsNull(ue_time_zone)) {
ogs_error("OpenAPI_sm_context_release_data_parseFromJSON() failed [ue_time_zone]");
goto end;
}
}
cJSON *add_ue_location = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "addUeLocation");
OpenAPI_user_location_t *add_ue_location_local_nonprim = NULL;
add_ue_location = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "addUeLocation");
if (add_ue_location) {
add_ue_location_local_nonprim = OpenAPI_user_location_parseFromJSON(add_ue_location);
}
cJSON *vsmf_release_only = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "vsmfReleaseOnly");
vsmf_release_only = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "vsmfReleaseOnly");
if (vsmf_release_only) {
if (!cJSON_IsBool(vsmf_release_only)) {
ogs_error("OpenAPI_sm_context_release_data_parseFromJSON() failed [vsmf_release_only]");
@ -224,16 +247,12 @@ OpenAPI_sm_context_release_data_t *OpenAPI_sm_context_release_data_parseFromJSON
}
}
cJSON *n2_sm_info = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "n2SmInfo");
OpenAPI_ref_to_binary_data_t *n2_sm_info_local_nonprim = NULL;
n2_sm_info = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "n2SmInfo");
if (n2_sm_info) {
n2_sm_info_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(n2_sm_info);
}
cJSON *n2_sm_info_type = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "n2SmInfoType");
OpenAPI_n2_sm_info_type_e n2_sm_info_typeVariable;
n2_sm_info_type = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "n2SmInfoType");
if (n2_sm_info_type) {
if (!cJSON_IsString(n2_sm_info_type)) {
ogs_error("OpenAPI_sm_context_release_data_parseFromJSON() failed [n2_sm_info_type]");
@ -242,8 +261,7 @@ OpenAPI_sm_context_release_data_t *OpenAPI_sm_context_release_data_parseFromJSON
n2_sm_info_typeVariable = OpenAPI_n2_sm_info_type_FromString(n2_sm_info_type->valuestring);
}
cJSON *ismf_release_only = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "ismfReleaseOnly");
ismf_release_only = cJSON_GetObjectItemCaseSensitive(sm_context_release_dataJSON, "ismfReleaseOnly");
if (ismf_release_only) {
if (!cJSON_IsBool(ismf_release_only)) {
ogs_error("OpenAPI_sm_context_release_data_parseFromJSON() failed [ismf_release_only]");
@ -257,7 +275,7 @@ OpenAPI_sm_context_release_data_t *OpenAPI_sm_context_release_data_parseFromJSON
_5g_mm_cause_value ? true : false,
_5g_mm_cause_value ? _5g_mm_cause_value->valuedouble : 0,
ue_location ? ue_location_local_nonprim : NULL,
ue_time_zone ? ogs_strdup(ue_time_zone->valuestring) : NULL,
ue_time_zone && !cJSON_IsNull(ue_time_zone) ? ogs_strdup(ue_time_zone->valuestring) : NULL,
add_ue_location ? add_ue_location_local_nonprim : NULL,
vsmf_release_only ? true : false,
vsmf_release_only ? vsmf_release_only->valueint : 0,
@ -269,6 +287,22 @@ OpenAPI_sm_context_release_data_t *OpenAPI_sm_context_release_data_parseFromJSON
return sm_context_release_data_local_var;
end:
if (ng_ap_cause_local_nonprim) {
OpenAPI_ng_ap_cause_free(ng_ap_cause_local_nonprim);
ng_ap_cause_local_nonprim = NULL;
}
if (ue_location_local_nonprim) {
OpenAPI_user_location_free(ue_location_local_nonprim);
ue_location_local_nonprim = NULL;
}
if (add_ue_location_local_nonprim) {
OpenAPI_user_location_free(add_ue_location_local_nonprim);
add_ue_location_local_nonprim = NULL;
}
if (n2_sm_info_local_nonprim) {
OpenAPI_ref_to_binary_data_free(n2_sm_info_local_nonprim);
n2_sm_info_local_nonprim = NULL;
}
return NULL;
}