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
|
|
@ -26,20 +26,34 @@ OpenAPI_sor_info_t *OpenAPI_sor_info_create(
|
|||
|
||||
void OpenAPI_sor_info_free(OpenAPI_sor_info_t *sor_info)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == sor_info) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_steering_container_free(sor_info->steering_container);
|
||||
ogs_free(sor_info->sor_mac_iausf);
|
||||
ogs_free(sor_info->countersor);
|
||||
ogs_free(sor_info->provisioning_time);
|
||||
if (sor_info->steering_container) {
|
||||
OpenAPI_steering_container_free(sor_info->steering_container);
|
||||
sor_info->steering_container = NULL;
|
||||
}
|
||||
if (sor_info->sor_mac_iausf) {
|
||||
ogs_free(sor_info->sor_mac_iausf);
|
||||
sor_info->sor_mac_iausf = NULL;
|
||||
}
|
||||
if (sor_info->countersor) {
|
||||
ogs_free(sor_info->countersor);
|
||||
sor_info->countersor = NULL;
|
||||
}
|
||||
if (sor_info->provisioning_time) {
|
||||
ogs_free(sor_info->provisioning_time);
|
||||
sor_info->provisioning_time = NULL;
|
||||
}
|
||||
ogs_free(sor_info);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_sor_info_convertToJSON(OpenAPI_sor_info_t *sor_info)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (sor_info == NULL) {
|
||||
ogs_error("OpenAPI_sor_info_convertToJSON() failed [SorInfo]");
|
||||
|
|
@ -79,6 +93,10 @@ cJSON *OpenAPI_sor_info_convertToJSON(OpenAPI_sor_info_t *sor_info)
|
|||
}
|
||||
}
|
||||
|
||||
if (!sor_info->provisioning_time) {
|
||||
ogs_error("OpenAPI_sor_info_convertToJSON() failed [provisioning_time]");
|
||||
return NULL;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "provisioningTime", sor_info->provisioning_time) == NULL) {
|
||||
ogs_error("OpenAPI_sor_info_convertToJSON() failed [provisioning_time]");
|
||||
goto end;
|
||||
|
|
@ -91,49 +109,50 @@ end:
|
|||
OpenAPI_sor_info_t *OpenAPI_sor_info_parseFromJSON(cJSON *sor_infoJSON)
|
||||
{
|
||||
OpenAPI_sor_info_t *sor_info_local_var = NULL;
|
||||
cJSON *steering_container = cJSON_GetObjectItemCaseSensitive(sor_infoJSON, "steeringContainer");
|
||||
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *steering_container = NULL;
|
||||
OpenAPI_steering_container_t *steering_container_local_nonprim = NULL;
|
||||
cJSON *ack_ind = NULL;
|
||||
cJSON *sor_mac_iausf = NULL;
|
||||
cJSON *countersor = NULL;
|
||||
cJSON *provisioning_time = NULL;
|
||||
steering_container = cJSON_GetObjectItemCaseSensitive(sor_infoJSON, "steeringContainer");
|
||||
if (steering_container) {
|
||||
steering_container_local_nonprim = OpenAPI_steering_container_parseFromJSON(steering_container);
|
||||
}
|
||||
|
||||
cJSON *ack_ind = cJSON_GetObjectItemCaseSensitive(sor_infoJSON, "ackInd");
|
||||
ack_ind = cJSON_GetObjectItemCaseSensitive(sor_infoJSON, "ackInd");
|
||||
if (!ack_ind) {
|
||||
ogs_error("OpenAPI_sor_info_parseFromJSON() failed [ack_ind]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!cJSON_IsBool(ack_ind)) {
|
||||
ogs_error("OpenAPI_sor_info_parseFromJSON() failed [ack_ind]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *sor_mac_iausf = cJSON_GetObjectItemCaseSensitive(sor_infoJSON, "sorMacIausf");
|
||||
|
||||
sor_mac_iausf = cJSON_GetObjectItemCaseSensitive(sor_infoJSON, "sorMacIausf");
|
||||
if (sor_mac_iausf) {
|
||||
if (!cJSON_IsString(sor_mac_iausf)) {
|
||||
if (!cJSON_IsString(sor_mac_iausf) && !cJSON_IsNull(sor_mac_iausf)) {
|
||||
ogs_error("OpenAPI_sor_info_parseFromJSON() failed [sor_mac_iausf]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *countersor = cJSON_GetObjectItemCaseSensitive(sor_infoJSON, "countersor");
|
||||
|
||||
countersor = cJSON_GetObjectItemCaseSensitive(sor_infoJSON, "countersor");
|
||||
if (countersor) {
|
||||
if (!cJSON_IsString(countersor)) {
|
||||
if (!cJSON_IsString(countersor) && !cJSON_IsNull(countersor)) {
|
||||
ogs_error("OpenAPI_sor_info_parseFromJSON() failed [countersor]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *provisioning_time = cJSON_GetObjectItemCaseSensitive(sor_infoJSON, "provisioningTime");
|
||||
provisioning_time = cJSON_GetObjectItemCaseSensitive(sor_infoJSON, "provisioningTime");
|
||||
if (!provisioning_time) {
|
||||
ogs_error("OpenAPI_sor_info_parseFromJSON() failed [provisioning_time]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!cJSON_IsString(provisioning_time)) {
|
||||
if (!cJSON_IsString(provisioning_time) && !cJSON_IsNull(provisioning_time)) {
|
||||
ogs_error("OpenAPI_sor_info_parseFromJSON() failed [provisioning_time]");
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -142,13 +161,17 @@ OpenAPI_sor_info_t *OpenAPI_sor_info_parseFromJSON(cJSON *sor_infoJSON)
|
|||
steering_container ? steering_container_local_nonprim : NULL,
|
||||
|
||||
ack_ind->valueint,
|
||||
sor_mac_iausf ? ogs_strdup(sor_mac_iausf->valuestring) : NULL,
|
||||
countersor ? ogs_strdup(countersor->valuestring) : NULL,
|
||||
sor_mac_iausf && !cJSON_IsNull(sor_mac_iausf) ? ogs_strdup(sor_mac_iausf->valuestring) : NULL,
|
||||
countersor && !cJSON_IsNull(countersor) ? ogs_strdup(countersor->valuestring) : NULL,
|
||||
ogs_strdup(provisioning_time->valuestring)
|
||||
);
|
||||
|
||||
return sor_info_local_var;
|
||||
end:
|
||||
if (steering_container_local_nonprim) {
|
||||
OpenAPI_steering_container_free(steering_container_local_nonprim);
|
||||
steering_container_local_nonprim = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue