[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

@ -24,19 +24,30 @@ OpenAPI_sor_data_t *OpenAPI_sor_data_create(
void OpenAPI_sor_data_free(OpenAPI_sor_data_t *sor_data)
{
OpenAPI_lnode_t *node = NULL;
if (NULL == sor_data) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(sor_data->provisioning_time);
ogs_free(sor_data->sor_xmac_iue);
ogs_free(sor_data->sor_mac_iue);
if (sor_data->provisioning_time) {
ogs_free(sor_data->provisioning_time);
sor_data->provisioning_time = NULL;
}
if (sor_data->sor_xmac_iue) {
ogs_free(sor_data->sor_xmac_iue);
sor_data->sor_xmac_iue = NULL;
}
if (sor_data->sor_mac_iue) {
ogs_free(sor_data->sor_mac_iue);
sor_data->sor_mac_iue = NULL;
}
ogs_free(sor_data);
}
cJSON *OpenAPI_sor_data_convertToJSON(OpenAPI_sor_data_t *sor_data)
{
cJSON *item = NULL;
OpenAPI_lnode_t *node = NULL;
if (sor_data == NULL) {
ogs_error("OpenAPI_sor_data_convertToJSON() failed [SorData]");
@ -44,11 +55,19 @@ cJSON *OpenAPI_sor_data_convertToJSON(OpenAPI_sor_data_t *sor_data)
}
item = cJSON_CreateObject();
if (!sor_data->provisioning_time) {
ogs_error("OpenAPI_sor_data_convertToJSON() failed [provisioning_time]");
return NULL;
}
if (cJSON_AddStringToObject(item, "provisioningTime", sor_data->provisioning_time) == NULL) {
ogs_error("OpenAPI_sor_data_convertToJSON() failed [provisioning_time]");
goto end;
}
if (sor_data->ue_update_status == OpenAPI_ue_update_status_NULL) {
ogs_error("OpenAPI_sor_data_convertToJSON() failed [ue_update_status]");
return NULL;
}
if (cJSON_AddStringToObject(item, "ueUpdateStatus", OpenAPI_ue_update_status_ToString(sor_data->ue_update_status)) == NULL) {
ogs_error("OpenAPI_sor_data_convertToJSON() failed [ue_update_status]");
goto end;
@ -75,43 +94,44 @@ end:
OpenAPI_sor_data_t *OpenAPI_sor_data_parseFromJSON(cJSON *sor_dataJSON)
{
OpenAPI_sor_data_t *sor_data_local_var = NULL;
cJSON *provisioning_time = cJSON_GetObjectItemCaseSensitive(sor_dataJSON, "provisioningTime");
OpenAPI_lnode_t *node = NULL;
cJSON *provisioning_time = NULL;
cJSON *ue_update_status = NULL;
OpenAPI_ue_update_status_e ue_update_statusVariable = 0;
cJSON *sor_xmac_iue = NULL;
cJSON *sor_mac_iue = NULL;
provisioning_time = cJSON_GetObjectItemCaseSensitive(sor_dataJSON, "provisioningTime");
if (!provisioning_time) {
ogs_error("OpenAPI_sor_data_parseFromJSON() failed [provisioning_time]");
goto end;
}
if (!cJSON_IsString(provisioning_time)) {
if (!cJSON_IsString(provisioning_time) && !cJSON_IsNull(provisioning_time)) {
ogs_error("OpenAPI_sor_data_parseFromJSON() failed [provisioning_time]");
goto end;
}
cJSON *ue_update_status = cJSON_GetObjectItemCaseSensitive(sor_dataJSON, "ueUpdateStatus");
ue_update_status = cJSON_GetObjectItemCaseSensitive(sor_dataJSON, "ueUpdateStatus");
if (!ue_update_status) {
ogs_error("OpenAPI_sor_data_parseFromJSON() failed [ue_update_status]");
goto end;
}
OpenAPI_ue_update_status_e ue_update_statusVariable;
if (!cJSON_IsString(ue_update_status)) {
ogs_error("OpenAPI_sor_data_parseFromJSON() failed [ue_update_status]");
goto end;
}
ue_update_statusVariable = OpenAPI_ue_update_status_FromString(ue_update_status->valuestring);
cJSON *sor_xmac_iue = cJSON_GetObjectItemCaseSensitive(sor_dataJSON, "sorXmacIue");
sor_xmac_iue = cJSON_GetObjectItemCaseSensitive(sor_dataJSON, "sorXmacIue");
if (sor_xmac_iue) {
if (!cJSON_IsString(sor_xmac_iue)) {
if (!cJSON_IsString(sor_xmac_iue) && !cJSON_IsNull(sor_xmac_iue)) {
ogs_error("OpenAPI_sor_data_parseFromJSON() failed [sor_xmac_iue]");
goto end;
}
}
cJSON *sor_mac_iue = cJSON_GetObjectItemCaseSensitive(sor_dataJSON, "sorMacIue");
sor_mac_iue = cJSON_GetObjectItemCaseSensitive(sor_dataJSON, "sorMacIue");
if (sor_mac_iue) {
if (!cJSON_IsString(sor_mac_iue)) {
if (!cJSON_IsString(sor_mac_iue) && !cJSON_IsNull(sor_mac_iue)) {
ogs_error("OpenAPI_sor_data_parseFromJSON() failed [sor_mac_iue]");
goto end;
}
@ -120,8 +140,8 @@ OpenAPI_sor_data_t *OpenAPI_sor_data_parseFromJSON(cJSON *sor_dataJSON)
sor_data_local_var = OpenAPI_sor_data_create (
ogs_strdup(provisioning_time->valuestring),
ue_update_statusVariable,
sor_xmac_iue ? ogs_strdup(sor_xmac_iue->valuestring) : NULL,
sor_mac_iue ? ogs_strdup(sor_mac_iue->valuestring) : NULL
sor_xmac_iue && !cJSON_IsNull(sor_xmac_iue) ? ogs_strdup(sor_xmac_iue->valuestring) : NULL,
sor_mac_iue && !cJSON_IsNull(sor_mac_iue) ? ogs_strdup(sor_mac_iue->valuestring) : NULL
);
return sor_data_local_var;