mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-05 07:08:11 +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
|
|
@ -30,24 +30,41 @@ OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_creat
|
|||
|
||||
void OpenAPI_authentication_info_request_free(OpenAPI_authentication_info_request_t *authentication_info_request)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == authentication_info_request) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(authentication_info_request->supported_features);
|
||||
ogs_free(authentication_info_request->serving_network_name);
|
||||
OpenAPI_resynchronization_info_free(authentication_info_request->resynchronization_info);
|
||||
ogs_free(authentication_info_request->ausf_instance_id);
|
||||
OpenAPI_list_for_each(authentication_info_request->cell_cag_info, node) {
|
||||
ogs_free(node->data);
|
||||
if (authentication_info_request->supported_features) {
|
||||
ogs_free(authentication_info_request->supported_features);
|
||||
authentication_info_request->supported_features = NULL;
|
||||
}
|
||||
if (authentication_info_request->serving_network_name) {
|
||||
ogs_free(authentication_info_request->serving_network_name);
|
||||
authentication_info_request->serving_network_name = NULL;
|
||||
}
|
||||
if (authentication_info_request->resynchronization_info) {
|
||||
OpenAPI_resynchronization_info_free(authentication_info_request->resynchronization_info);
|
||||
authentication_info_request->resynchronization_info = NULL;
|
||||
}
|
||||
if (authentication_info_request->ausf_instance_id) {
|
||||
ogs_free(authentication_info_request->ausf_instance_id);
|
||||
authentication_info_request->ausf_instance_id = NULL;
|
||||
}
|
||||
if (authentication_info_request->cell_cag_info) {
|
||||
OpenAPI_list_for_each(authentication_info_request->cell_cag_info, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(authentication_info_request->cell_cag_info);
|
||||
authentication_info_request->cell_cag_info = NULL;
|
||||
}
|
||||
OpenAPI_list_free(authentication_info_request->cell_cag_info);
|
||||
ogs_free(authentication_info_request);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_authentication_info_request_convertToJSON(OpenAPI_authentication_info_request_t *authentication_info_request)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (authentication_info_request == NULL) {
|
||||
ogs_error("OpenAPI_authentication_info_request_convertToJSON() failed [AuthenticationInfoRequest]");
|
||||
|
|
@ -62,6 +79,10 @@ cJSON *OpenAPI_authentication_info_request_convertToJSON(OpenAPI_authentication_
|
|||
}
|
||||
}
|
||||
|
||||
if (!authentication_info_request->serving_network_name) {
|
||||
ogs_error("OpenAPI_authentication_info_request_convertToJSON() failed [serving_network_name]");
|
||||
return NULL;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "servingNetworkName", authentication_info_request->serving_network_name) == NULL) {
|
||||
ogs_error("OpenAPI_authentication_info_request_convertToJSON() failed [serving_network_name]");
|
||||
goto end;
|
||||
|
|
@ -80,25 +101,27 @@ cJSON *OpenAPI_authentication_info_request_convertToJSON(OpenAPI_authentication_
|
|||
}
|
||||
}
|
||||
|
||||
if (!authentication_info_request->ausf_instance_id) {
|
||||
ogs_error("OpenAPI_authentication_info_request_convertToJSON() failed [ausf_instance_id]");
|
||||
return NULL;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "ausfInstanceId", authentication_info_request->ausf_instance_id) == NULL) {
|
||||
ogs_error("OpenAPI_authentication_info_request_convertToJSON() failed [ausf_instance_id]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (authentication_info_request->cell_cag_info) {
|
||||
cJSON *cell_cag_info = cJSON_AddArrayToObject(item, "cellCagInfo");
|
||||
if (cell_cag_info == NULL) {
|
||||
cJSON *cell_cag_infoList = cJSON_AddArrayToObject(item, "cellCagInfo");
|
||||
if (cell_cag_infoList == NULL) {
|
||||
ogs_error("OpenAPI_authentication_info_request_convertToJSON() failed [cell_cag_info]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *cell_cag_info_node;
|
||||
OpenAPI_list_for_each(authentication_info_request->cell_cag_info, cell_cag_info_node) {
|
||||
if (cJSON_AddStringToObject(cell_cag_info, "", (char*)cell_cag_info_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_authentication_info_request_convertToJSON() failed [cell_cag_info]");
|
||||
goto end;
|
||||
OpenAPI_list_for_each(authentication_info_request->cell_cag_info, node) {
|
||||
if (cJSON_AddStringToObject(cell_cag_infoList, "", (char*)node->data) == NULL) {
|
||||
ogs_error("OpenAPI_authentication_info_request_convertToJSON() failed [cell_cag_info]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (authentication_info_request->is_n5gc_ind) {
|
||||
|
|
@ -115,66 +138,70 @@ end:
|
|||
OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_parseFromJSON(cJSON *authentication_info_requestJSON)
|
||||
{
|
||||
OpenAPI_authentication_info_request_t *authentication_info_request_local_var = NULL;
|
||||
cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(authentication_info_requestJSON, "supportedFeatures");
|
||||
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *supported_features = NULL;
|
||||
cJSON *serving_network_name = NULL;
|
||||
cJSON *resynchronization_info = NULL;
|
||||
OpenAPI_resynchronization_info_t *resynchronization_info_local_nonprim = NULL;
|
||||
cJSON *ausf_instance_id = NULL;
|
||||
cJSON *cell_cag_info = NULL;
|
||||
OpenAPI_list_t *cell_cag_infoList = NULL;
|
||||
cJSON *n5gc_ind = NULL;
|
||||
supported_features = cJSON_GetObjectItemCaseSensitive(authentication_info_requestJSON, "supportedFeatures");
|
||||
if (supported_features) {
|
||||
if (!cJSON_IsString(supported_features)) {
|
||||
if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) {
|
||||
ogs_error("OpenAPI_authentication_info_request_parseFromJSON() failed [supported_features]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *serving_network_name = cJSON_GetObjectItemCaseSensitive(authentication_info_requestJSON, "servingNetworkName");
|
||||
serving_network_name = cJSON_GetObjectItemCaseSensitive(authentication_info_requestJSON, "servingNetworkName");
|
||||
if (!serving_network_name) {
|
||||
ogs_error("OpenAPI_authentication_info_request_parseFromJSON() failed [serving_network_name]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!cJSON_IsString(serving_network_name)) {
|
||||
ogs_error("OpenAPI_authentication_info_request_parseFromJSON() failed [serving_network_name]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *resynchronization_info = cJSON_GetObjectItemCaseSensitive(authentication_info_requestJSON, "resynchronizationInfo");
|
||||
|
||||
OpenAPI_resynchronization_info_t *resynchronization_info_local_nonprim = NULL;
|
||||
resynchronization_info = cJSON_GetObjectItemCaseSensitive(authentication_info_requestJSON, "resynchronizationInfo");
|
||||
if (resynchronization_info) {
|
||||
resynchronization_info_local_nonprim = OpenAPI_resynchronization_info_parseFromJSON(resynchronization_info);
|
||||
}
|
||||
|
||||
cJSON *ausf_instance_id = cJSON_GetObjectItemCaseSensitive(authentication_info_requestJSON, "ausfInstanceId");
|
||||
ausf_instance_id = cJSON_GetObjectItemCaseSensitive(authentication_info_requestJSON, "ausfInstanceId");
|
||||
if (!ausf_instance_id) {
|
||||
ogs_error("OpenAPI_authentication_info_request_parseFromJSON() failed [ausf_instance_id]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!cJSON_IsString(ausf_instance_id)) {
|
||||
ogs_error("OpenAPI_authentication_info_request_parseFromJSON() failed [ausf_instance_id]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *cell_cag_info = cJSON_GetObjectItemCaseSensitive(authentication_info_requestJSON, "cellCagInfo");
|
||||
|
||||
OpenAPI_list_t *cell_cag_infoList;
|
||||
cell_cag_info = cJSON_GetObjectItemCaseSensitive(authentication_info_requestJSON, "cellCagInfo");
|
||||
if (cell_cag_info) {
|
||||
cJSON *cell_cag_info_local;
|
||||
if (!cJSON_IsArray(cell_cag_info)) {
|
||||
ogs_error("OpenAPI_authentication_info_request_parseFromJSON() failed [cell_cag_info]");
|
||||
goto end;
|
||||
}
|
||||
cell_cag_infoList = OpenAPI_list_create();
|
||||
cJSON *cell_cag_info_local = NULL;
|
||||
if (!cJSON_IsArray(cell_cag_info)) {
|
||||
ogs_error("OpenAPI_authentication_info_request_parseFromJSON() failed [cell_cag_info]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON_ArrayForEach(cell_cag_info_local, cell_cag_info) {
|
||||
if (!cJSON_IsString(cell_cag_info_local)) {
|
||||
ogs_error("OpenAPI_authentication_info_request_parseFromJSON() failed [cell_cag_info]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(cell_cag_infoList, ogs_strdup(cell_cag_info_local->valuestring));
|
||||
}
|
||||
cell_cag_infoList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(cell_cag_info_local, cell_cag_info) {
|
||||
double *localDouble = NULL;
|
||||
int *localInt = NULL;
|
||||
if (!cJSON_IsString(cell_cag_info_local)) {
|
||||
ogs_error("OpenAPI_authentication_info_request_parseFromJSON() failed [cell_cag_info]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(cell_cag_infoList, ogs_strdup(cell_cag_info_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *n5gc_ind = cJSON_GetObjectItemCaseSensitive(authentication_info_requestJSON, "n5gcInd");
|
||||
|
||||
n5gc_ind = cJSON_GetObjectItemCaseSensitive(authentication_info_requestJSON, "n5gcInd");
|
||||
if (n5gc_ind) {
|
||||
if (!cJSON_IsBool(n5gc_ind)) {
|
||||
ogs_error("OpenAPI_authentication_info_request_parseFromJSON() failed [n5gc_ind]");
|
||||
|
|
@ -183,7 +210,7 @@ OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_parse
|
|||
}
|
||||
|
||||
authentication_info_request_local_var = OpenAPI_authentication_info_request_create (
|
||||
supported_features ? ogs_strdup(supported_features->valuestring) : NULL,
|
||||
supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL,
|
||||
ogs_strdup(serving_network_name->valuestring),
|
||||
resynchronization_info ? resynchronization_info_local_nonprim : NULL,
|
||||
ogs_strdup(ausf_instance_id->valuestring),
|
||||
|
|
@ -194,6 +221,17 @@ OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_parse
|
|||
|
||||
return authentication_info_request_local_var;
|
||||
end:
|
||||
if (resynchronization_info_local_nonprim) {
|
||||
OpenAPI_resynchronization_info_free(resynchronization_info_local_nonprim);
|
||||
resynchronization_info_local_nonprim = NULL;
|
||||
}
|
||||
if (cell_cag_infoList) {
|
||||
OpenAPI_list_for_each(cell_cag_infoList, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(cell_cag_infoList);
|
||||
cell_cag_infoList = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue