[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

@ -22,18 +22,26 @@ OpenAPI_confirmation_data_response_t *OpenAPI_confirmation_data_response_create(
void OpenAPI_confirmation_data_response_free(OpenAPI_confirmation_data_response_t *confirmation_data_response)
{
OpenAPI_lnode_t *node = NULL;
if (NULL == confirmation_data_response) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(confirmation_data_response->supi);
ogs_free(confirmation_data_response->kseaf);
if (confirmation_data_response->supi) {
ogs_free(confirmation_data_response->supi);
confirmation_data_response->supi = NULL;
}
if (confirmation_data_response->kseaf) {
ogs_free(confirmation_data_response->kseaf);
confirmation_data_response->kseaf = NULL;
}
ogs_free(confirmation_data_response);
}
cJSON *OpenAPI_confirmation_data_response_convertToJSON(OpenAPI_confirmation_data_response_t *confirmation_data_response)
{
cJSON *item = NULL;
OpenAPI_lnode_t *node = NULL;
if (confirmation_data_response == NULL) {
ogs_error("OpenAPI_confirmation_data_response_convertToJSON() failed [ConfirmationDataResponse]");
@ -41,6 +49,10 @@ cJSON *OpenAPI_confirmation_data_response_convertToJSON(OpenAPI_confirmation_dat
}
item = cJSON_CreateObject();
if (confirmation_data_response->auth_result == OpenAPI_auth_result_NULL) {
ogs_error("OpenAPI_confirmation_data_response_convertToJSON() failed [auth_result]");
return NULL;
}
if (cJSON_AddStringToObject(item, "authResult", OpenAPI_auth_result_ToString(confirmation_data_response->auth_result)) == NULL) {
ogs_error("OpenAPI_confirmation_data_response_convertToJSON() failed [auth_result]");
goto end;
@ -67,32 +79,33 @@ end:
OpenAPI_confirmation_data_response_t *OpenAPI_confirmation_data_response_parseFromJSON(cJSON *confirmation_data_responseJSON)
{
OpenAPI_confirmation_data_response_t *confirmation_data_response_local_var = NULL;
cJSON *auth_result = cJSON_GetObjectItemCaseSensitive(confirmation_data_responseJSON, "authResult");
OpenAPI_lnode_t *node = NULL;
cJSON *auth_result = NULL;
OpenAPI_auth_result_e auth_resultVariable = 0;
cJSON *supi = NULL;
cJSON *kseaf = NULL;
auth_result = cJSON_GetObjectItemCaseSensitive(confirmation_data_responseJSON, "authResult");
if (!auth_result) {
ogs_error("OpenAPI_confirmation_data_response_parseFromJSON() failed [auth_result]");
goto end;
}
OpenAPI_auth_result_e auth_resultVariable;
if (!cJSON_IsString(auth_result)) {
ogs_error("OpenAPI_confirmation_data_response_parseFromJSON() failed [auth_result]");
goto end;
}
auth_resultVariable = OpenAPI_auth_result_FromString(auth_result->valuestring);
cJSON *supi = cJSON_GetObjectItemCaseSensitive(confirmation_data_responseJSON, "supi");
supi = cJSON_GetObjectItemCaseSensitive(confirmation_data_responseJSON, "supi");
if (supi) {
if (!cJSON_IsString(supi)) {
if (!cJSON_IsString(supi) && !cJSON_IsNull(supi)) {
ogs_error("OpenAPI_confirmation_data_response_parseFromJSON() failed [supi]");
goto end;
}
}
cJSON *kseaf = cJSON_GetObjectItemCaseSensitive(confirmation_data_responseJSON, "kseaf");
kseaf = cJSON_GetObjectItemCaseSensitive(confirmation_data_responseJSON, "kseaf");
if (kseaf) {
if (!cJSON_IsString(kseaf)) {
if (!cJSON_IsString(kseaf) && !cJSON_IsNull(kseaf)) {
ogs_error("OpenAPI_confirmation_data_response_parseFromJSON() failed [kseaf]");
goto end;
}
@ -100,8 +113,8 @@ OpenAPI_confirmation_data_response_t *OpenAPI_confirmation_data_response_parseFr
confirmation_data_response_local_var = OpenAPI_confirmation_data_response_create (
auth_resultVariable,
supi ? ogs_strdup(supi->valuestring) : NULL,
kseaf ? ogs_strdup(kseaf->valuestring) : NULL
supi && !cJSON_IsNull(supi) ? ogs_strdup(supi->valuestring) : NULL,
kseaf && !cJSON_IsNull(kseaf) ? ogs_strdup(kseaf->valuestring) : NULL
);
return confirmation_data_response_local_var;