mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-03 05:40: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
|
|
@ -36,18 +36,26 @@ OpenAPI_reporting_options_t *OpenAPI_reporting_options_create(
|
|||
|
||||
void OpenAPI_reporting_options_free(OpenAPI_reporting_options_t *reporting_options)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == reporting_options) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_event_report_mode_free(reporting_options->report_mode);
|
||||
ogs_free(reporting_options->expiry);
|
||||
if (reporting_options->report_mode) {
|
||||
OpenAPI_event_report_mode_free(reporting_options->report_mode);
|
||||
reporting_options->report_mode = NULL;
|
||||
}
|
||||
if (reporting_options->expiry) {
|
||||
ogs_free(reporting_options->expiry);
|
||||
reporting_options->expiry = NULL;
|
||||
}
|
||||
ogs_free(reporting_options);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_reporting_options_convertToJSON(OpenAPI_reporting_options_t *reporting_options)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (reporting_options == NULL) {
|
||||
ogs_error("OpenAPI_reporting_options_convertToJSON() failed [ReportingOptions]");
|
||||
|
|
@ -110,15 +118,20 @@ end:
|
|||
OpenAPI_reporting_options_t *OpenAPI_reporting_options_parseFromJSON(cJSON *reporting_optionsJSON)
|
||||
{
|
||||
OpenAPI_reporting_options_t *reporting_options_local_var = NULL;
|
||||
cJSON *report_mode = cJSON_GetObjectItemCaseSensitive(reporting_optionsJSON, "reportMode");
|
||||
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *report_mode = NULL;
|
||||
OpenAPI_event_report_mode_t *report_mode_local_nonprim = NULL;
|
||||
cJSON *max_num_of_reports = NULL;
|
||||
cJSON *expiry = NULL;
|
||||
cJSON *sampling_ratio = NULL;
|
||||
cJSON *guard_time = NULL;
|
||||
cJSON *report_period = NULL;
|
||||
report_mode = cJSON_GetObjectItemCaseSensitive(reporting_optionsJSON, "reportMode");
|
||||
if (report_mode) {
|
||||
report_mode_local_nonprim = OpenAPI_event_report_mode_parseFromJSON(report_mode);
|
||||
}
|
||||
|
||||
cJSON *max_num_of_reports = cJSON_GetObjectItemCaseSensitive(reporting_optionsJSON, "maxNumOfReports");
|
||||
|
||||
max_num_of_reports = cJSON_GetObjectItemCaseSensitive(reporting_optionsJSON, "maxNumOfReports");
|
||||
if (max_num_of_reports) {
|
||||
if (!cJSON_IsNumber(max_num_of_reports)) {
|
||||
ogs_error("OpenAPI_reporting_options_parseFromJSON() failed [max_num_of_reports]");
|
||||
|
|
@ -126,17 +139,15 @@ OpenAPI_reporting_options_t *OpenAPI_reporting_options_parseFromJSON(cJSON *repo
|
|||
}
|
||||
}
|
||||
|
||||
cJSON *expiry = cJSON_GetObjectItemCaseSensitive(reporting_optionsJSON, "expiry");
|
||||
|
||||
expiry = cJSON_GetObjectItemCaseSensitive(reporting_optionsJSON, "expiry");
|
||||
if (expiry) {
|
||||
if (!cJSON_IsString(expiry)) {
|
||||
if (!cJSON_IsString(expiry) && !cJSON_IsNull(expiry)) {
|
||||
ogs_error("OpenAPI_reporting_options_parseFromJSON() failed [expiry]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *sampling_ratio = cJSON_GetObjectItemCaseSensitive(reporting_optionsJSON, "samplingRatio");
|
||||
|
||||
sampling_ratio = cJSON_GetObjectItemCaseSensitive(reporting_optionsJSON, "samplingRatio");
|
||||
if (sampling_ratio) {
|
||||
if (!cJSON_IsNumber(sampling_ratio)) {
|
||||
ogs_error("OpenAPI_reporting_options_parseFromJSON() failed [sampling_ratio]");
|
||||
|
|
@ -144,8 +155,7 @@ OpenAPI_reporting_options_t *OpenAPI_reporting_options_parseFromJSON(cJSON *repo
|
|||
}
|
||||
}
|
||||
|
||||
cJSON *guard_time = cJSON_GetObjectItemCaseSensitive(reporting_optionsJSON, "guardTime");
|
||||
|
||||
guard_time = cJSON_GetObjectItemCaseSensitive(reporting_optionsJSON, "guardTime");
|
||||
if (guard_time) {
|
||||
if (!cJSON_IsNumber(guard_time)) {
|
||||
ogs_error("OpenAPI_reporting_options_parseFromJSON() failed [guard_time]");
|
||||
|
|
@ -153,8 +163,7 @@ OpenAPI_reporting_options_t *OpenAPI_reporting_options_parseFromJSON(cJSON *repo
|
|||
}
|
||||
}
|
||||
|
||||
cJSON *report_period = cJSON_GetObjectItemCaseSensitive(reporting_optionsJSON, "reportPeriod");
|
||||
|
||||
report_period = cJSON_GetObjectItemCaseSensitive(reporting_optionsJSON, "reportPeriod");
|
||||
if (report_period) {
|
||||
if (!cJSON_IsNumber(report_period)) {
|
||||
ogs_error("OpenAPI_reporting_options_parseFromJSON() failed [report_period]");
|
||||
|
|
@ -166,7 +175,7 @@ OpenAPI_reporting_options_t *OpenAPI_reporting_options_parseFromJSON(cJSON *repo
|
|||
report_mode ? report_mode_local_nonprim : NULL,
|
||||
max_num_of_reports ? true : false,
|
||||
max_num_of_reports ? max_num_of_reports->valuedouble : 0,
|
||||
expiry ? ogs_strdup(expiry->valuestring) : NULL,
|
||||
expiry && !cJSON_IsNull(expiry) ? ogs_strdup(expiry->valuestring) : NULL,
|
||||
sampling_ratio ? true : false,
|
||||
sampling_ratio ? sampling_ratio->valuedouble : 0,
|
||||
guard_time ? true : false,
|
||||
|
|
@ -177,6 +186,10 @@ OpenAPI_reporting_options_t *OpenAPI_reporting_options_parseFromJSON(cJSON *repo
|
|||
|
||||
return reporting_options_local_var;
|
||||
end:
|
||||
if (report_mode_local_nonprim) {
|
||||
OpenAPI_event_report_mode_free(report_mode_local_nonprim);
|
||||
report_mode_local_nonprim = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue