[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

@ -26,33 +26,50 @@ OpenAPI_hss_info_t *OpenAPI_hss_info_create(
void OpenAPI_hss_info_free(OpenAPI_hss_info_t *hss_info)
{
OpenAPI_lnode_t *node = NULL;
if (NULL == hss_info) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(hss_info->group_id);
OpenAPI_list_for_each(hss_info->imsi_ranges, node) {
OpenAPI_imsi_range_free(node->data);
if (hss_info->group_id) {
ogs_free(hss_info->group_id);
hss_info->group_id = NULL;
}
OpenAPI_list_free(hss_info->imsi_ranges);
OpenAPI_list_for_each(hss_info->ims_private_identity_ranges, node) {
OpenAPI_identity_range_free(node->data);
if (hss_info->imsi_ranges) {
OpenAPI_list_for_each(hss_info->imsi_ranges, node) {
OpenAPI_imsi_range_free(node->data);
}
OpenAPI_list_free(hss_info->imsi_ranges);
hss_info->imsi_ranges = NULL;
}
OpenAPI_list_free(hss_info->ims_private_identity_ranges);
OpenAPI_list_for_each(hss_info->ims_public_identity_ranges, node) {
OpenAPI_identity_range_free(node->data);
if (hss_info->ims_private_identity_ranges) {
OpenAPI_list_for_each(hss_info->ims_private_identity_ranges, node) {
OpenAPI_identity_range_free(node->data);
}
OpenAPI_list_free(hss_info->ims_private_identity_ranges);
hss_info->ims_private_identity_ranges = NULL;
}
OpenAPI_list_free(hss_info->ims_public_identity_ranges);
OpenAPI_list_for_each(hss_info->msisdn_ranges, node) {
OpenAPI_identity_range_free(node->data);
if (hss_info->ims_public_identity_ranges) {
OpenAPI_list_for_each(hss_info->ims_public_identity_ranges, node) {
OpenAPI_identity_range_free(node->data);
}
OpenAPI_list_free(hss_info->ims_public_identity_ranges);
hss_info->ims_public_identity_ranges = NULL;
}
if (hss_info->msisdn_ranges) {
OpenAPI_list_for_each(hss_info->msisdn_ranges, node) {
OpenAPI_identity_range_free(node->data);
}
OpenAPI_list_free(hss_info->msisdn_ranges);
hss_info->msisdn_ranges = NULL;
}
OpenAPI_list_free(hss_info->msisdn_ranges);
ogs_free(hss_info);
}
cJSON *OpenAPI_hss_info_convertToJSON(OpenAPI_hss_info_t *hss_info)
{
cJSON *item = NULL;
OpenAPI_lnode_t *node = NULL;
if (hss_info == NULL) {
ogs_error("OpenAPI_hss_info_convertToJSON() failed [HssInfo]");
@ -73,17 +90,13 @@ cJSON *OpenAPI_hss_info_convertToJSON(OpenAPI_hss_info_t *hss_info)
ogs_error("OpenAPI_hss_info_convertToJSON() failed [imsi_ranges]");
goto end;
}
OpenAPI_lnode_t *imsi_ranges_node;
if (hss_info->imsi_ranges) {
OpenAPI_list_for_each(hss_info->imsi_ranges, imsi_ranges_node) {
cJSON *itemLocal = OpenAPI_imsi_range_convertToJSON(imsi_ranges_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_hss_info_convertToJSON() failed [imsi_ranges]");
goto end;
}
cJSON_AddItemToArray(imsi_rangesList, itemLocal);
OpenAPI_list_for_each(hss_info->imsi_ranges, node) {
cJSON *itemLocal = OpenAPI_imsi_range_convertToJSON(node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_hss_info_convertToJSON() failed [imsi_ranges]");
goto end;
}
cJSON_AddItemToArray(imsi_rangesList, itemLocal);
}
}
@ -93,17 +106,13 @@ cJSON *OpenAPI_hss_info_convertToJSON(OpenAPI_hss_info_t *hss_info)
ogs_error("OpenAPI_hss_info_convertToJSON() failed [ims_private_identity_ranges]");
goto end;
}
OpenAPI_lnode_t *ims_private_identity_ranges_node;
if (hss_info->ims_private_identity_ranges) {
OpenAPI_list_for_each(hss_info->ims_private_identity_ranges, ims_private_identity_ranges_node) {
cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(ims_private_identity_ranges_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_hss_info_convertToJSON() failed [ims_private_identity_ranges]");
goto end;
}
cJSON_AddItemToArray(ims_private_identity_rangesList, itemLocal);
OpenAPI_list_for_each(hss_info->ims_private_identity_ranges, node) {
cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_hss_info_convertToJSON() failed [ims_private_identity_ranges]");
goto end;
}
cJSON_AddItemToArray(ims_private_identity_rangesList, itemLocal);
}
}
@ -113,17 +122,13 @@ cJSON *OpenAPI_hss_info_convertToJSON(OpenAPI_hss_info_t *hss_info)
ogs_error("OpenAPI_hss_info_convertToJSON() failed [ims_public_identity_ranges]");
goto end;
}
OpenAPI_lnode_t *ims_public_identity_ranges_node;
if (hss_info->ims_public_identity_ranges) {
OpenAPI_list_for_each(hss_info->ims_public_identity_ranges, ims_public_identity_ranges_node) {
cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(ims_public_identity_ranges_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_hss_info_convertToJSON() failed [ims_public_identity_ranges]");
goto end;
}
cJSON_AddItemToArray(ims_public_identity_rangesList, itemLocal);
OpenAPI_list_for_each(hss_info->ims_public_identity_ranges, node) {
cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_hss_info_convertToJSON() failed [ims_public_identity_ranges]");
goto end;
}
cJSON_AddItemToArray(ims_public_identity_rangesList, itemLocal);
}
}
@ -133,17 +138,13 @@ cJSON *OpenAPI_hss_info_convertToJSON(OpenAPI_hss_info_t *hss_info)
ogs_error("OpenAPI_hss_info_convertToJSON() failed [msisdn_ranges]");
goto end;
}
OpenAPI_lnode_t *msisdn_ranges_node;
if (hss_info->msisdn_ranges) {
OpenAPI_list_for_each(hss_info->msisdn_ranges, msisdn_ranges_node) {
cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(msisdn_ranges_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_hss_info_convertToJSON() failed [msisdn_ranges]");
goto end;
}
cJSON_AddItemToArray(msisdn_rangesList, itemLocal);
OpenAPI_list_for_each(hss_info->msisdn_ranges, node) {
cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_hss_info_convertToJSON() failed [msisdn_ranges]");
goto end;
}
cJSON_AddItemToArray(msisdn_rangesList, itemLocal);
}
}
@ -154,133 +155,126 @@ end:
OpenAPI_hss_info_t *OpenAPI_hss_info_parseFromJSON(cJSON *hss_infoJSON)
{
OpenAPI_hss_info_t *hss_info_local_var = NULL;
cJSON *group_id = cJSON_GetObjectItemCaseSensitive(hss_infoJSON, "groupId");
OpenAPI_lnode_t *node = NULL;
cJSON *group_id = NULL;
cJSON *imsi_ranges = NULL;
OpenAPI_list_t *imsi_rangesList = NULL;
cJSON *ims_private_identity_ranges = NULL;
OpenAPI_list_t *ims_private_identity_rangesList = NULL;
cJSON *ims_public_identity_ranges = NULL;
OpenAPI_list_t *ims_public_identity_rangesList = NULL;
cJSON *msisdn_ranges = NULL;
OpenAPI_list_t *msisdn_rangesList = NULL;
group_id = cJSON_GetObjectItemCaseSensitive(hss_infoJSON, "groupId");
if (group_id) {
if (!cJSON_IsString(group_id)) {
if (!cJSON_IsString(group_id) && !cJSON_IsNull(group_id)) {
ogs_error("OpenAPI_hss_info_parseFromJSON() failed [group_id]");
goto end;
}
}
cJSON *imsi_ranges = cJSON_GetObjectItemCaseSensitive(hss_infoJSON, "imsiRanges");
OpenAPI_list_t *imsi_rangesList;
imsi_ranges = cJSON_GetObjectItemCaseSensitive(hss_infoJSON, "imsiRanges");
if (imsi_ranges) {
cJSON *imsi_ranges_local_nonprimitive;
if (!cJSON_IsArray(imsi_ranges)){
ogs_error("OpenAPI_hss_info_parseFromJSON() failed [imsi_ranges]");
goto end;
}
imsi_rangesList = OpenAPI_list_create();
cJSON_ArrayForEach(imsi_ranges_local_nonprimitive, imsi_ranges ) {
if (!cJSON_IsObject(imsi_ranges_local_nonprimitive)) {
cJSON *imsi_ranges_local = NULL;
if (!cJSON_IsArray(imsi_ranges)) {
ogs_error("OpenAPI_hss_info_parseFromJSON() failed [imsi_ranges]");
goto end;
}
OpenAPI_imsi_range_t *imsi_rangesItem = OpenAPI_imsi_range_parseFromJSON(imsi_ranges_local_nonprimitive);
if (!imsi_rangesItem) {
ogs_error("No imsi_rangesItem");
OpenAPI_list_free(imsi_rangesList);
goto end;
imsi_rangesList = OpenAPI_list_create();
cJSON_ArrayForEach(imsi_ranges_local, imsi_ranges) {
if (!cJSON_IsObject(imsi_ranges_local)) {
ogs_error("OpenAPI_hss_info_parseFromJSON() failed [imsi_ranges]");
goto end;
}
OpenAPI_imsi_range_t *imsi_rangesItem = OpenAPI_imsi_range_parseFromJSON(imsi_ranges_local);
if (!imsi_rangesItem) {
ogs_error("No imsi_rangesItem");
OpenAPI_list_free(imsi_rangesList);
goto end;
}
OpenAPI_list_add(imsi_rangesList, imsi_rangesItem);
}
OpenAPI_list_add(imsi_rangesList, imsi_rangesItem);
}
}
cJSON *ims_private_identity_ranges = cJSON_GetObjectItemCaseSensitive(hss_infoJSON, "imsPrivateIdentityRanges");
OpenAPI_list_t *ims_private_identity_rangesList;
ims_private_identity_ranges = cJSON_GetObjectItemCaseSensitive(hss_infoJSON, "imsPrivateIdentityRanges");
if (ims_private_identity_ranges) {
cJSON *ims_private_identity_ranges_local_nonprimitive;
if (!cJSON_IsArray(ims_private_identity_ranges)){
ogs_error("OpenAPI_hss_info_parseFromJSON() failed [ims_private_identity_ranges]");
goto end;
}
ims_private_identity_rangesList = OpenAPI_list_create();
cJSON_ArrayForEach(ims_private_identity_ranges_local_nonprimitive, ims_private_identity_ranges ) {
if (!cJSON_IsObject(ims_private_identity_ranges_local_nonprimitive)) {
cJSON *ims_private_identity_ranges_local = NULL;
if (!cJSON_IsArray(ims_private_identity_ranges)) {
ogs_error("OpenAPI_hss_info_parseFromJSON() failed [ims_private_identity_ranges]");
goto end;
}
OpenAPI_identity_range_t *ims_private_identity_rangesItem = OpenAPI_identity_range_parseFromJSON(ims_private_identity_ranges_local_nonprimitive);
if (!ims_private_identity_rangesItem) {
ogs_error("No ims_private_identity_rangesItem");
OpenAPI_list_free(ims_private_identity_rangesList);
goto end;
ims_private_identity_rangesList = OpenAPI_list_create();
cJSON_ArrayForEach(ims_private_identity_ranges_local, ims_private_identity_ranges) {
if (!cJSON_IsObject(ims_private_identity_ranges_local)) {
ogs_error("OpenAPI_hss_info_parseFromJSON() failed [ims_private_identity_ranges]");
goto end;
}
OpenAPI_identity_range_t *ims_private_identity_rangesItem = OpenAPI_identity_range_parseFromJSON(ims_private_identity_ranges_local);
if (!ims_private_identity_rangesItem) {
ogs_error("No ims_private_identity_rangesItem");
OpenAPI_list_free(ims_private_identity_rangesList);
goto end;
}
OpenAPI_list_add(ims_private_identity_rangesList, ims_private_identity_rangesItem);
}
OpenAPI_list_add(ims_private_identity_rangesList, ims_private_identity_rangesItem);
}
}
cJSON *ims_public_identity_ranges = cJSON_GetObjectItemCaseSensitive(hss_infoJSON, "imsPublicIdentityRanges");
OpenAPI_list_t *ims_public_identity_rangesList;
ims_public_identity_ranges = cJSON_GetObjectItemCaseSensitive(hss_infoJSON, "imsPublicIdentityRanges");
if (ims_public_identity_ranges) {
cJSON *ims_public_identity_ranges_local_nonprimitive;
if (!cJSON_IsArray(ims_public_identity_ranges)){
ogs_error("OpenAPI_hss_info_parseFromJSON() failed [ims_public_identity_ranges]");
goto end;
}
ims_public_identity_rangesList = OpenAPI_list_create();
cJSON_ArrayForEach(ims_public_identity_ranges_local_nonprimitive, ims_public_identity_ranges ) {
if (!cJSON_IsObject(ims_public_identity_ranges_local_nonprimitive)) {
cJSON *ims_public_identity_ranges_local = NULL;
if (!cJSON_IsArray(ims_public_identity_ranges)) {
ogs_error("OpenAPI_hss_info_parseFromJSON() failed [ims_public_identity_ranges]");
goto end;
}
OpenAPI_identity_range_t *ims_public_identity_rangesItem = OpenAPI_identity_range_parseFromJSON(ims_public_identity_ranges_local_nonprimitive);
if (!ims_public_identity_rangesItem) {
ogs_error("No ims_public_identity_rangesItem");
OpenAPI_list_free(ims_public_identity_rangesList);
goto end;
ims_public_identity_rangesList = OpenAPI_list_create();
cJSON_ArrayForEach(ims_public_identity_ranges_local, ims_public_identity_ranges) {
if (!cJSON_IsObject(ims_public_identity_ranges_local)) {
ogs_error("OpenAPI_hss_info_parseFromJSON() failed [ims_public_identity_ranges]");
goto end;
}
OpenAPI_identity_range_t *ims_public_identity_rangesItem = OpenAPI_identity_range_parseFromJSON(ims_public_identity_ranges_local);
if (!ims_public_identity_rangesItem) {
ogs_error("No ims_public_identity_rangesItem");
OpenAPI_list_free(ims_public_identity_rangesList);
goto end;
}
OpenAPI_list_add(ims_public_identity_rangesList, ims_public_identity_rangesItem);
}
OpenAPI_list_add(ims_public_identity_rangesList, ims_public_identity_rangesItem);
}
}
cJSON *msisdn_ranges = cJSON_GetObjectItemCaseSensitive(hss_infoJSON, "msisdnRanges");
OpenAPI_list_t *msisdn_rangesList;
msisdn_ranges = cJSON_GetObjectItemCaseSensitive(hss_infoJSON, "msisdnRanges");
if (msisdn_ranges) {
cJSON *msisdn_ranges_local_nonprimitive;
if (!cJSON_IsArray(msisdn_ranges)){
ogs_error("OpenAPI_hss_info_parseFromJSON() failed [msisdn_ranges]");
goto end;
}
msisdn_rangesList = OpenAPI_list_create();
cJSON_ArrayForEach(msisdn_ranges_local_nonprimitive, msisdn_ranges ) {
if (!cJSON_IsObject(msisdn_ranges_local_nonprimitive)) {
cJSON *msisdn_ranges_local = NULL;
if (!cJSON_IsArray(msisdn_ranges)) {
ogs_error("OpenAPI_hss_info_parseFromJSON() failed [msisdn_ranges]");
goto end;
}
OpenAPI_identity_range_t *msisdn_rangesItem = OpenAPI_identity_range_parseFromJSON(msisdn_ranges_local_nonprimitive);
if (!msisdn_rangesItem) {
ogs_error("No msisdn_rangesItem");
OpenAPI_list_free(msisdn_rangesList);
goto end;
msisdn_rangesList = OpenAPI_list_create();
cJSON_ArrayForEach(msisdn_ranges_local, msisdn_ranges) {
if (!cJSON_IsObject(msisdn_ranges_local)) {
ogs_error("OpenAPI_hss_info_parseFromJSON() failed [msisdn_ranges]");
goto end;
}
OpenAPI_identity_range_t *msisdn_rangesItem = OpenAPI_identity_range_parseFromJSON(msisdn_ranges_local);
if (!msisdn_rangesItem) {
ogs_error("No msisdn_rangesItem");
OpenAPI_list_free(msisdn_rangesList);
goto end;
}
OpenAPI_list_add(msisdn_rangesList, msisdn_rangesItem);
}
OpenAPI_list_add(msisdn_rangesList, msisdn_rangesItem);
}
}
hss_info_local_var = OpenAPI_hss_info_create (
group_id ? ogs_strdup(group_id->valuestring) : NULL,
group_id && !cJSON_IsNull(group_id) ? ogs_strdup(group_id->valuestring) : NULL,
imsi_ranges ? imsi_rangesList : NULL,
ims_private_identity_ranges ? ims_private_identity_rangesList : NULL,
ims_public_identity_ranges ? ims_public_identity_rangesList : NULL,
@ -289,6 +283,34 @@ OpenAPI_hss_info_t *OpenAPI_hss_info_parseFromJSON(cJSON *hss_infoJSON)
return hss_info_local_var;
end:
if (imsi_rangesList) {
OpenAPI_list_for_each(imsi_rangesList, node) {
OpenAPI_imsi_range_free(node->data);
}
OpenAPI_list_free(imsi_rangesList);
imsi_rangesList = NULL;
}
if (ims_private_identity_rangesList) {
OpenAPI_list_for_each(ims_private_identity_rangesList, node) {
OpenAPI_identity_range_free(node->data);
}
OpenAPI_list_free(ims_private_identity_rangesList);
ims_private_identity_rangesList = NULL;
}
if (ims_public_identity_rangesList) {
OpenAPI_list_for_each(ims_public_identity_rangesList, node) {
OpenAPI_identity_range_free(node->data);
}
OpenAPI_list_free(ims_public_identity_rangesList);
ims_public_identity_rangesList = NULL;
}
if (msisdn_rangesList) {
OpenAPI_list_for_each(msisdn_rangesList, node) {
OpenAPI_identity_range_free(node->data);
}
OpenAPI_list_free(msisdn_rangesList);
msisdn_rangesList = NULL;
}
return NULL;
}