mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-04 14:20: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
|
|
@ -22,19 +22,30 @@ OpenAPI_acs_info_t *OpenAPI_acs_info_create(
|
|||
|
||||
void OpenAPI_acs_info_free(OpenAPI_acs_info_t *acs_info)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == acs_info) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(acs_info->acs_url);
|
||||
ogs_free(acs_info->acs_ipv4_addr);
|
||||
ogs_free(acs_info->acs_ipv6_addr);
|
||||
if (acs_info->acs_url) {
|
||||
ogs_free(acs_info->acs_url);
|
||||
acs_info->acs_url = NULL;
|
||||
}
|
||||
if (acs_info->acs_ipv4_addr) {
|
||||
ogs_free(acs_info->acs_ipv4_addr);
|
||||
acs_info->acs_ipv4_addr = NULL;
|
||||
}
|
||||
if (acs_info->acs_ipv6_addr) {
|
||||
ogs_free(acs_info->acs_ipv6_addr);
|
||||
acs_info->acs_ipv6_addr = NULL;
|
||||
}
|
||||
ogs_free(acs_info);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_acs_info_convertToJSON(OpenAPI_acs_info_t *acs_info)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (acs_info == NULL) {
|
||||
ogs_error("OpenAPI_acs_info_convertToJSON() failed [AcsInfo]");
|
||||
|
|
@ -70,37 +81,38 @@ end:
|
|||
OpenAPI_acs_info_t *OpenAPI_acs_info_parseFromJSON(cJSON *acs_infoJSON)
|
||||
{
|
||||
OpenAPI_acs_info_t *acs_info_local_var = NULL;
|
||||
cJSON *acs_url = cJSON_GetObjectItemCaseSensitive(acs_infoJSON, "acsUrl");
|
||||
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *acs_url = NULL;
|
||||
cJSON *acs_ipv4_addr = NULL;
|
||||
cJSON *acs_ipv6_addr = NULL;
|
||||
acs_url = cJSON_GetObjectItemCaseSensitive(acs_infoJSON, "acsUrl");
|
||||
if (acs_url) {
|
||||
if (!cJSON_IsString(acs_url)) {
|
||||
if (!cJSON_IsString(acs_url) && !cJSON_IsNull(acs_url)) {
|
||||
ogs_error("OpenAPI_acs_info_parseFromJSON() failed [acs_url]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *acs_ipv4_addr = cJSON_GetObjectItemCaseSensitive(acs_infoJSON, "acsIpv4Addr");
|
||||
|
||||
acs_ipv4_addr = cJSON_GetObjectItemCaseSensitive(acs_infoJSON, "acsIpv4Addr");
|
||||
if (acs_ipv4_addr) {
|
||||
if (!cJSON_IsString(acs_ipv4_addr)) {
|
||||
if (!cJSON_IsString(acs_ipv4_addr) && !cJSON_IsNull(acs_ipv4_addr)) {
|
||||
ogs_error("OpenAPI_acs_info_parseFromJSON() failed [acs_ipv4_addr]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *acs_ipv6_addr = cJSON_GetObjectItemCaseSensitive(acs_infoJSON, "acsIpv6Addr");
|
||||
|
||||
acs_ipv6_addr = cJSON_GetObjectItemCaseSensitive(acs_infoJSON, "acsIpv6Addr");
|
||||
if (acs_ipv6_addr) {
|
||||
if (!cJSON_IsString(acs_ipv6_addr)) {
|
||||
if (!cJSON_IsString(acs_ipv6_addr) && !cJSON_IsNull(acs_ipv6_addr)) {
|
||||
ogs_error("OpenAPI_acs_info_parseFromJSON() failed [acs_ipv6_addr]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
acs_info_local_var = OpenAPI_acs_info_create (
|
||||
acs_url ? ogs_strdup(acs_url->valuestring) : NULL,
|
||||
acs_ipv4_addr ? ogs_strdup(acs_ipv4_addr->valuestring) : NULL,
|
||||
acs_ipv6_addr ? ogs_strdup(acs_ipv6_addr->valuestring) : NULL
|
||||
acs_url && !cJSON_IsNull(acs_url) ? ogs_strdup(acs_url->valuestring) : NULL,
|
||||
acs_ipv4_addr && !cJSON_IsNull(acs_ipv4_addr) ? ogs_strdup(acs_ipv4_addr->valuestring) : NULL,
|
||||
acs_ipv6_addr && !cJSON_IsNull(acs_ipv6_addr) ? ogs_strdup(acs_ipv6_addr->valuestring) : NULL
|
||||
);
|
||||
|
||||
return acs_info_local_var;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue