[SBI] Fixed crash if no BW Unit(Xbps) (#2000)

This commit is contained in:
Sukchan Lee 2023-01-24 21:55:06 +09:00
parent 218b31d006
commit 596a2f1b5e
2 changed files with 23 additions and 4 deletions

View File

@ -540,6 +540,11 @@ uint64_t ogs_sbi_bitrate_from_string(char *str)
unit = strrchr(str, ' ');
bitrate = atoll(str);
if (!unit) {
ogs_error("No Unit [%s]", str);
return bitrate;
}
SWITCH(unit+1)
CASE("Kbps")
return bitrate * 1024;

View File

@ -633,6 +633,13 @@ bool pcf_npcf_policyauthorization_handle_create(pcf_sess_t *sess,
uint8_t qos_index = 0;
ogs_media_component_t *media_component = &ims_data.media_component[i];
if (media_component->media_type == OpenAPI_media_type_NULL) {
strerror = ogs_msprintf("[%s:%d] Media-Type is Required",
pcf_ue->supi, sess->psi);
status = OGS_SBI_HTTP_STATUS_BAD_REQUEST;
goto cleanup;
}
switch(media_component->media_type) {
case OpenAPI_media_type_AUDIO:
qos_index = OGS_QOS_INDEX_1;
@ -644,9 +651,9 @@ bool pcf_npcf_policyauthorization_handle_create(pcf_sess_t *sess,
qos_index = OGS_QOS_INDEX_5;
break;
default:
strerror = ogs_msprintf("[%s:%d] Not implemented : [Media-Type:%d]",
strerror = ogs_msprintf("[%s:%d] Unknown Media-Type [%d]",
pcf_ue->supi, sess->psi, media_component->media_type);
status = OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR;
status = OGS_SBI_HTTP_STATUS_BAD_REQUEST;
goto cleanup;
}
@ -1046,6 +1053,13 @@ bool pcf_npcf_policyauthorization_handle_update(
uint8_t qos_index = 0;
ogs_media_component_t *media_component = &ims_data.media_component[i];
if (media_component->media_type == OpenAPI_media_type_NULL) {
strerror = ogs_msprintf("[%s:%d] Media-Type is Required",
pcf_ue->supi, sess->psi);
status = OGS_SBI_HTTP_STATUS_BAD_REQUEST;
goto cleanup;
}
switch(media_component->media_type) {
case OpenAPI_media_type_AUDIO:
qos_index = OGS_QOS_INDEX_1;
@ -1057,9 +1071,9 @@ bool pcf_npcf_policyauthorization_handle_update(
qos_index = OGS_QOS_INDEX_5;
break;
default:
strerror = ogs_msprintf("[%s:%d] Not implemented : [Media-Type:%d]",
strerror = ogs_msprintf("[%s:%d] Unknown Media-Type [%d]",
pcf_ue->supi, sess->psi, media_component->media_type);
status = OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR;
status = OGS_SBI_HTTP_STATUS_BAD_REQUEST;
goto cleanup;
}