mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-04 22:30:09 +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
|
|
@ -24,20 +24,25 @@ OpenAPI_acc_net_ch_id_t *OpenAPI_acc_net_ch_id_create(
|
|||
|
||||
void OpenAPI_acc_net_ch_id_free(OpenAPI_acc_net_ch_id_t *acc_net_ch_id)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == acc_net_ch_id) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_list_for_each(acc_net_ch_id->ref_pcc_rule_ids, node) {
|
||||
ogs_free(node->data);
|
||||
if (acc_net_ch_id->ref_pcc_rule_ids) {
|
||||
OpenAPI_list_for_each(acc_net_ch_id->ref_pcc_rule_ids, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(acc_net_ch_id->ref_pcc_rule_ids);
|
||||
acc_net_ch_id->ref_pcc_rule_ids = NULL;
|
||||
}
|
||||
OpenAPI_list_free(acc_net_ch_id->ref_pcc_rule_ids);
|
||||
ogs_free(acc_net_ch_id);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_acc_net_ch_id_convertToJSON(OpenAPI_acc_net_ch_id_t *acc_net_ch_id)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (acc_net_ch_id == NULL) {
|
||||
ogs_error("OpenAPI_acc_net_ch_id_convertToJSON() failed [AccNetChId]");
|
||||
|
|
@ -51,19 +56,17 @@ cJSON *OpenAPI_acc_net_ch_id_convertToJSON(OpenAPI_acc_net_ch_id_t *acc_net_ch_i
|
|||
}
|
||||
|
||||
if (acc_net_ch_id->ref_pcc_rule_ids) {
|
||||
cJSON *ref_pcc_rule_ids = cJSON_AddArrayToObject(item, "refPccRuleIds");
|
||||
if (ref_pcc_rule_ids == NULL) {
|
||||
cJSON *ref_pcc_rule_idsList = cJSON_AddArrayToObject(item, "refPccRuleIds");
|
||||
if (ref_pcc_rule_idsList == NULL) {
|
||||
ogs_error("OpenAPI_acc_net_ch_id_convertToJSON() failed [ref_pcc_rule_ids]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *ref_pcc_rule_ids_node;
|
||||
OpenAPI_list_for_each(acc_net_ch_id->ref_pcc_rule_ids, ref_pcc_rule_ids_node) {
|
||||
if (cJSON_AddStringToObject(ref_pcc_rule_ids, "", (char*)ref_pcc_rule_ids_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_acc_net_ch_id_convertToJSON() failed [ref_pcc_rule_ids]");
|
||||
goto end;
|
||||
OpenAPI_list_for_each(acc_net_ch_id->ref_pcc_rule_ids, node) {
|
||||
if (cJSON_AddStringToObject(ref_pcc_rule_idsList, "", (char*)node->data) == NULL) {
|
||||
ogs_error("OpenAPI_acc_net_ch_id_convertToJSON() failed [ref_pcc_rule_ids]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (acc_net_ch_id->is_session_ch_scope) {
|
||||
|
|
@ -80,39 +83,43 @@ end:
|
|||
OpenAPI_acc_net_ch_id_t *OpenAPI_acc_net_ch_id_parseFromJSON(cJSON *acc_net_ch_idJSON)
|
||||
{
|
||||
OpenAPI_acc_net_ch_id_t *acc_net_ch_id_local_var = NULL;
|
||||
cJSON *acc_net_cha_id_value = cJSON_GetObjectItemCaseSensitive(acc_net_ch_idJSON, "accNetChaIdValue");
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *acc_net_cha_id_value = NULL;
|
||||
cJSON *ref_pcc_rule_ids = NULL;
|
||||
OpenAPI_list_t *ref_pcc_rule_idsList = NULL;
|
||||
cJSON *session_ch_scope = NULL;
|
||||
acc_net_cha_id_value = cJSON_GetObjectItemCaseSensitive(acc_net_ch_idJSON, "accNetChaIdValue");
|
||||
if (!acc_net_cha_id_value) {
|
||||
ogs_error("OpenAPI_acc_net_ch_id_parseFromJSON() failed [acc_net_cha_id_value]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!cJSON_IsNumber(acc_net_cha_id_value)) {
|
||||
ogs_error("OpenAPI_acc_net_ch_id_parseFromJSON() failed [acc_net_cha_id_value]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *ref_pcc_rule_ids = cJSON_GetObjectItemCaseSensitive(acc_net_ch_idJSON, "refPccRuleIds");
|
||||
|
||||
OpenAPI_list_t *ref_pcc_rule_idsList;
|
||||
ref_pcc_rule_ids = cJSON_GetObjectItemCaseSensitive(acc_net_ch_idJSON, "refPccRuleIds");
|
||||
if (ref_pcc_rule_ids) {
|
||||
cJSON *ref_pcc_rule_ids_local;
|
||||
if (!cJSON_IsArray(ref_pcc_rule_ids)) {
|
||||
ogs_error("OpenAPI_acc_net_ch_id_parseFromJSON() failed [ref_pcc_rule_ids]");
|
||||
goto end;
|
||||
}
|
||||
ref_pcc_rule_idsList = OpenAPI_list_create();
|
||||
cJSON *ref_pcc_rule_ids_local = NULL;
|
||||
if (!cJSON_IsArray(ref_pcc_rule_ids)) {
|
||||
ogs_error("OpenAPI_acc_net_ch_id_parseFromJSON() failed [ref_pcc_rule_ids]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON_ArrayForEach(ref_pcc_rule_ids_local, ref_pcc_rule_ids) {
|
||||
if (!cJSON_IsString(ref_pcc_rule_ids_local)) {
|
||||
ogs_error("OpenAPI_acc_net_ch_id_parseFromJSON() failed [ref_pcc_rule_ids]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(ref_pcc_rule_idsList, ogs_strdup(ref_pcc_rule_ids_local->valuestring));
|
||||
}
|
||||
ref_pcc_rule_idsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(ref_pcc_rule_ids_local, ref_pcc_rule_ids) {
|
||||
double *localDouble = NULL;
|
||||
int *localInt = NULL;
|
||||
if (!cJSON_IsString(ref_pcc_rule_ids_local)) {
|
||||
ogs_error("OpenAPI_acc_net_ch_id_parseFromJSON() failed [ref_pcc_rule_ids]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(ref_pcc_rule_idsList, ogs_strdup(ref_pcc_rule_ids_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *session_ch_scope = cJSON_GetObjectItemCaseSensitive(acc_net_ch_idJSON, "sessionChScope");
|
||||
|
||||
session_ch_scope = cJSON_GetObjectItemCaseSensitive(acc_net_ch_idJSON, "sessionChScope");
|
||||
if (session_ch_scope) {
|
||||
if (!cJSON_IsBool(session_ch_scope)) {
|
||||
ogs_error("OpenAPI_acc_net_ch_id_parseFromJSON() failed [session_ch_scope]");
|
||||
|
|
@ -130,6 +137,13 @@ OpenAPI_acc_net_ch_id_t *OpenAPI_acc_net_ch_id_parseFromJSON(cJSON *acc_net_ch_i
|
|||
|
||||
return acc_net_ch_id_local_var;
|
||||
end:
|
||||
if (ref_pcc_rule_idsList) {
|
||||
OpenAPI_list_for_each(ref_pcc_rule_idsList, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(ref_pcc_rule_idsList);
|
||||
ref_pcc_rule_idsList = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue