mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-02 13:20:08 +00:00
[SBI] Crash occurs when ENUM in the MAP (#2103)
This commit is contained in:
parent
ce668c556c
commit
969c116e77
1097 changed files with 266728 additions and 42047 deletions
|
|
@ -32,23 +32,46 @@ OpenAPI_authentication_vector_t *OpenAPI_authentication_vector_create(
|
|||
|
||||
void OpenAPI_authentication_vector_free(OpenAPI_authentication_vector_t *authentication_vector)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == authentication_vector) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(authentication_vector->rand);
|
||||
ogs_free(authentication_vector->xres);
|
||||
ogs_free(authentication_vector->autn);
|
||||
ogs_free(authentication_vector->ck_prime);
|
||||
ogs_free(authentication_vector->ik_prime);
|
||||
ogs_free(authentication_vector->xres_star);
|
||||
ogs_free(authentication_vector->kausf);
|
||||
if (authentication_vector->rand) {
|
||||
ogs_free(authentication_vector->rand);
|
||||
authentication_vector->rand = NULL;
|
||||
}
|
||||
if (authentication_vector->xres) {
|
||||
ogs_free(authentication_vector->xres);
|
||||
authentication_vector->xres = NULL;
|
||||
}
|
||||
if (authentication_vector->autn) {
|
||||
ogs_free(authentication_vector->autn);
|
||||
authentication_vector->autn = NULL;
|
||||
}
|
||||
if (authentication_vector->ck_prime) {
|
||||
ogs_free(authentication_vector->ck_prime);
|
||||
authentication_vector->ck_prime = NULL;
|
||||
}
|
||||
if (authentication_vector->ik_prime) {
|
||||
ogs_free(authentication_vector->ik_prime);
|
||||
authentication_vector->ik_prime = NULL;
|
||||
}
|
||||
if (authentication_vector->xres_star) {
|
||||
ogs_free(authentication_vector->xres_star);
|
||||
authentication_vector->xres_star = NULL;
|
||||
}
|
||||
if (authentication_vector->kausf) {
|
||||
ogs_free(authentication_vector->kausf);
|
||||
authentication_vector->kausf = NULL;
|
||||
}
|
||||
ogs_free(authentication_vector);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_authentication_vector_convertToJSON(OpenAPI_authentication_vector_t *authentication_vector)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (authentication_vector == NULL) {
|
||||
ogs_error("OpenAPI_authentication_vector_convertToJSON() failed [AuthenticationVector]");
|
||||
|
|
@ -56,11 +79,19 @@ cJSON *OpenAPI_authentication_vector_convertToJSON(OpenAPI_authentication_vector
|
|||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (authentication_vector->av_type == OpenAPI_av_type_NULL) {
|
||||
ogs_error("OpenAPI_authentication_vector_convertToJSON() failed [av_type]");
|
||||
return NULL;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "avType", OpenAPI_av_type_ToString(authentication_vector->av_type)) == NULL) {
|
||||
ogs_error("OpenAPI_authentication_vector_convertToJSON() failed [av_type]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!authentication_vector->rand) {
|
||||
ogs_error("OpenAPI_authentication_vector_convertToJSON() failed [rand]");
|
||||
return NULL;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "rand", authentication_vector->rand) == NULL) {
|
||||
ogs_error("OpenAPI_authentication_vector_convertToJSON() failed [rand]");
|
||||
goto end;
|
||||
|
|
@ -73,6 +104,10 @@ cJSON *OpenAPI_authentication_vector_convertToJSON(OpenAPI_authentication_vector
|
|||
}
|
||||
}
|
||||
|
||||
if (!authentication_vector->autn) {
|
||||
ogs_error("OpenAPI_authentication_vector_convertToJSON() failed [autn]");
|
||||
return NULL;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "autn", authentication_vector->autn) == NULL) {
|
||||
ogs_error("OpenAPI_authentication_vector_convertToJSON() failed [autn]");
|
||||
goto end;
|
||||
|
|
@ -113,81 +148,82 @@ end:
|
|||
OpenAPI_authentication_vector_t *OpenAPI_authentication_vector_parseFromJSON(cJSON *authentication_vectorJSON)
|
||||
{
|
||||
OpenAPI_authentication_vector_t *authentication_vector_local_var = NULL;
|
||||
cJSON *av_type = cJSON_GetObjectItemCaseSensitive(authentication_vectorJSON, "avType");
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *av_type = NULL;
|
||||
OpenAPI_av_type_e av_typeVariable = 0;
|
||||
cJSON *rand = NULL;
|
||||
cJSON *xres = NULL;
|
||||
cJSON *autn = NULL;
|
||||
cJSON *ck_prime = NULL;
|
||||
cJSON *ik_prime = NULL;
|
||||
cJSON *xres_star = NULL;
|
||||
cJSON *kausf = NULL;
|
||||
av_type = cJSON_GetObjectItemCaseSensitive(authentication_vectorJSON, "avType");
|
||||
if (!av_type) {
|
||||
ogs_error("OpenAPI_authentication_vector_parseFromJSON() failed [av_type]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_av_type_e av_typeVariable;
|
||||
if (!cJSON_IsString(av_type)) {
|
||||
ogs_error("OpenAPI_authentication_vector_parseFromJSON() failed [av_type]");
|
||||
goto end;
|
||||
}
|
||||
av_typeVariable = OpenAPI_av_type_FromString(av_type->valuestring);
|
||||
|
||||
cJSON *rand = cJSON_GetObjectItemCaseSensitive(authentication_vectorJSON, "rand");
|
||||
rand = cJSON_GetObjectItemCaseSensitive(authentication_vectorJSON, "rand");
|
||||
if (!rand) {
|
||||
ogs_error("OpenAPI_authentication_vector_parseFromJSON() failed [rand]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!cJSON_IsString(rand)) {
|
||||
ogs_error("OpenAPI_authentication_vector_parseFromJSON() failed [rand]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *xres = cJSON_GetObjectItemCaseSensitive(authentication_vectorJSON, "xres");
|
||||
|
||||
xres = cJSON_GetObjectItemCaseSensitive(authentication_vectorJSON, "xres");
|
||||
if (xres) {
|
||||
if (!cJSON_IsString(xres)) {
|
||||
if (!cJSON_IsString(xres) && !cJSON_IsNull(xres)) {
|
||||
ogs_error("OpenAPI_authentication_vector_parseFromJSON() failed [xres]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *autn = cJSON_GetObjectItemCaseSensitive(authentication_vectorJSON, "autn");
|
||||
autn = cJSON_GetObjectItemCaseSensitive(authentication_vectorJSON, "autn");
|
||||
if (!autn) {
|
||||
ogs_error("OpenAPI_authentication_vector_parseFromJSON() failed [autn]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!cJSON_IsString(autn)) {
|
||||
ogs_error("OpenAPI_authentication_vector_parseFromJSON() failed [autn]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *ck_prime = cJSON_GetObjectItemCaseSensitive(authentication_vectorJSON, "ckPrime");
|
||||
|
||||
ck_prime = cJSON_GetObjectItemCaseSensitive(authentication_vectorJSON, "ckPrime");
|
||||
if (ck_prime) {
|
||||
if (!cJSON_IsString(ck_prime)) {
|
||||
if (!cJSON_IsString(ck_prime) && !cJSON_IsNull(ck_prime)) {
|
||||
ogs_error("OpenAPI_authentication_vector_parseFromJSON() failed [ck_prime]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *ik_prime = cJSON_GetObjectItemCaseSensitive(authentication_vectorJSON, "ikPrime");
|
||||
|
||||
ik_prime = cJSON_GetObjectItemCaseSensitive(authentication_vectorJSON, "ikPrime");
|
||||
if (ik_prime) {
|
||||
if (!cJSON_IsString(ik_prime)) {
|
||||
if (!cJSON_IsString(ik_prime) && !cJSON_IsNull(ik_prime)) {
|
||||
ogs_error("OpenAPI_authentication_vector_parseFromJSON() failed [ik_prime]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *xres_star = cJSON_GetObjectItemCaseSensitive(authentication_vectorJSON, "xresStar");
|
||||
|
||||
xres_star = cJSON_GetObjectItemCaseSensitive(authentication_vectorJSON, "xresStar");
|
||||
if (xres_star) {
|
||||
if (!cJSON_IsString(xres_star)) {
|
||||
if (!cJSON_IsString(xres_star) && !cJSON_IsNull(xres_star)) {
|
||||
ogs_error("OpenAPI_authentication_vector_parseFromJSON() failed [xres_star]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *kausf = cJSON_GetObjectItemCaseSensitive(authentication_vectorJSON, "kausf");
|
||||
|
||||
kausf = cJSON_GetObjectItemCaseSensitive(authentication_vectorJSON, "kausf");
|
||||
if (kausf) {
|
||||
if (!cJSON_IsString(kausf)) {
|
||||
if (!cJSON_IsString(kausf) && !cJSON_IsNull(kausf)) {
|
||||
ogs_error("OpenAPI_authentication_vector_parseFromJSON() failed [kausf]");
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -196,12 +232,12 @@ OpenAPI_authentication_vector_t *OpenAPI_authentication_vector_parseFromJSON(cJS
|
|||
authentication_vector_local_var = OpenAPI_authentication_vector_create (
|
||||
av_typeVariable,
|
||||
ogs_strdup(rand->valuestring),
|
||||
xres ? ogs_strdup(xres->valuestring) : NULL,
|
||||
xres && !cJSON_IsNull(xres) ? ogs_strdup(xres->valuestring) : NULL,
|
||||
ogs_strdup(autn->valuestring),
|
||||
ck_prime ? ogs_strdup(ck_prime->valuestring) : NULL,
|
||||
ik_prime ? ogs_strdup(ik_prime->valuestring) : NULL,
|
||||
xres_star ? ogs_strdup(xres_star->valuestring) : NULL,
|
||||
kausf ? ogs_strdup(kausf->valuestring) : NULL
|
||||
ck_prime && !cJSON_IsNull(ck_prime) ? ogs_strdup(ck_prime->valuestring) : NULL,
|
||||
ik_prime && !cJSON_IsNull(ik_prime) ? ogs_strdup(ik_prime->valuestring) : NULL,
|
||||
xres_star && !cJSON_IsNull(xres_star) ? ogs_strdup(xres_star->valuestring) : NULL,
|
||||
kausf && !cJSON_IsNull(kausf) ? ogs_strdup(kausf->valuestring) : NULL
|
||||
);
|
||||
|
||||
return authentication_vector_local_var;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue