[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,18 +24,26 @@ OpenAPI_up_security_info_t *OpenAPI_up_security_info_create(
void OpenAPI_up_security_info_free(OpenAPI_up_security_info_t *up_security_info)
{
OpenAPI_lnode_t *node = NULL;
if (NULL == up_security_info) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_up_security_free(up_security_info->up_security);
OpenAPI_security_result_free(up_security_info->security_result);
if (up_security_info->up_security) {
OpenAPI_up_security_free(up_security_info->up_security);
up_security_info->up_security = NULL;
}
if (up_security_info->security_result) {
OpenAPI_security_result_free(up_security_info->security_result);
up_security_info->security_result = NULL;
}
ogs_free(up_security_info);
}
cJSON *OpenAPI_up_security_info_convertToJSON(OpenAPI_up_security_info_t *up_security_info)
{
cJSON *item = NULL;
OpenAPI_lnode_t *node = NULL;
if (up_security_info == NULL) {
ogs_error("OpenAPI_up_security_info_convertToJSON() failed [UpSecurityInfo]");
@ -43,6 +51,10 @@ cJSON *OpenAPI_up_security_info_convertToJSON(OpenAPI_up_security_info_t *up_sec
}
item = cJSON_CreateObject();
if (!up_security_info->up_security) {
ogs_error("OpenAPI_up_security_info_convertToJSON() failed [up_security]");
return NULL;
}
cJSON *up_security_local_JSON = OpenAPI_up_security_convertToJSON(up_security_info->up_security);
if (up_security_local_JSON == NULL) {
ogs_error("OpenAPI_up_security_info_convertToJSON() failed [up_security]");
@ -54,14 +66,14 @@ cJSON *OpenAPI_up_security_info_convertToJSON(OpenAPI_up_security_info_t *up_sec
goto end;
}
if (up_security_info->max_integrity_protected_data_rate_ul) {
if (up_security_info->max_integrity_protected_data_rate_ul != OpenAPI_max_integrity_protected_data_rate_NULL) {
if (cJSON_AddStringToObject(item, "maxIntegrityProtectedDataRateUl", OpenAPI_max_integrity_protected_data_rate_ToString(up_security_info->max_integrity_protected_data_rate_ul)) == NULL) {
ogs_error("OpenAPI_up_security_info_convertToJSON() failed [max_integrity_protected_data_rate_ul]");
goto end;
}
}
if (up_security_info->max_integrity_protected_data_rate_dl) {
if (up_security_info->max_integrity_protected_data_rate_dl != OpenAPI_max_integrity_protected_data_rate_NULL) {
if (cJSON_AddStringToObject(item, "maxIntegrityProtectedDataRateDl", OpenAPI_max_integrity_protected_data_rate_ToString(up_security_info->max_integrity_protected_data_rate_dl)) == NULL) {
ogs_error("OpenAPI_up_security_info_convertToJSON() failed [max_integrity_protected_data_rate_dl]");
goto end;
@ -88,18 +100,23 @@ end:
OpenAPI_up_security_info_t *OpenAPI_up_security_info_parseFromJSON(cJSON *up_security_infoJSON)
{
OpenAPI_up_security_info_t *up_security_info_local_var = NULL;
cJSON *up_security = cJSON_GetObjectItemCaseSensitive(up_security_infoJSON, "upSecurity");
OpenAPI_lnode_t *node = NULL;
cJSON *up_security = NULL;
OpenAPI_up_security_t *up_security_local_nonprim = NULL;
cJSON *max_integrity_protected_data_rate_ul = NULL;
OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_ulVariable = 0;
cJSON *max_integrity_protected_data_rate_dl = NULL;
OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_dlVariable = 0;
cJSON *security_result = NULL;
OpenAPI_security_result_t *security_result_local_nonprim = NULL;
up_security = cJSON_GetObjectItemCaseSensitive(up_security_infoJSON, "upSecurity");
if (!up_security) {
ogs_error("OpenAPI_up_security_info_parseFromJSON() failed [up_security]");
goto end;
}
OpenAPI_up_security_t *up_security_local_nonprim = NULL;
up_security_local_nonprim = OpenAPI_up_security_parseFromJSON(up_security);
cJSON *max_integrity_protected_data_rate_ul = cJSON_GetObjectItemCaseSensitive(up_security_infoJSON, "maxIntegrityProtectedDataRateUl");
OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_ulVariable;
max_integrity_protected_data_rate_ul = cJSON_GetObjectItemCaseSensitive(up_security_infoJSON, "maxIntegrityProtectedDataRateUl");
if (max_integrity_protected_data_rate_ul) {
if (!cJSON_IsString(max_integrity_protected_data_rate_ul)) {
ogs_error("OpenAPI_up_security_info_parseFromJSON() failed [max_integrity_protected_data_rate_ul]");
@ -108,9 +125,7 @@ OpenAPI_up_security_info_t *OpenAPI_up_security_info_parseFromJSON(cJSON *up_sec
max_integrity_protected_data_rate_ulVariable = OpenAPI_max_integrity_protected_data_rate_FromString(max_integrity_protected_data_rate_ul->valuestring);
}
cJSON *max_integrity_protected_data_rate_dl = cJSON_GetObjectItemCaseSensitive(up_security_infoJSON, "maxIntegrityProtectedDataRateDl");
OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_dlVariable;
max_integrity_protected_data_rate_dl = cJSON_GetObjectItemCaseSensitive(up_security_infoJSON, "maxIntegrityProtectedDataRateDl");
if (max_integrity_protected_data_rate_dl) {
if (!cJSON_IsString(max_integrity_protected_data_rate_dl)) {
ogs_error("OpenAPI_up_security_info_parseFromJSON() failed [max_integrity_protected_data_rate_dl]");
@ -119,9 +134,7 @@ OpenAPI_up_security_info_t *OpenAPI_up_security_info_parseFromJSON(cJSON *up_sec
max_integrity_protected_data_rate_dlVariable = OpenAPI_max_integrity_protected_data_rate_FromString(max_integrity_protected_data_rate_dl->valuestring);
}
cJSON *security_result = cJSON_GetObjectItemCaseSensitive(up_security_infoJSON, "securityResult");
OpenAPI_security_result_t *security_result_local_nonprim = NULL;
security_result = cJSON_GetObjectItemCaseSensitive(up_security_infoJSON, "securityResult");
if (security_result) {
security_result_local_nonprim = OpenAPI_security_result_parseFromJSON(security_result);
}
@ -135,6 +148,14 @@ OpenAPI_up_security_info_t *OpenAPI_up_security_info_parseFromJSON(cJSON *up_sec
return up_security_info_local_var;
end:
if (up_security_local_nonprim) {
OpenAPI_up_security_free(up_security_local_nonprim);
up_security_local_nonprim = NULL;
}
if (security_result_local_nonprim) {
OpenAPI_security_result_free(security_result_local_nonprim);
security_result_local_nonprim = NULL;
}
return NULL;
}