fix: prevent AF crash when requestedQoS is missing#198
Conversation
|
Hi @jordijoangimenez,
|
rjb1000
left a comment
There was a problem hiding this comment.
Just a few suggestions for improvements to log messages.
|
@rjb1000 Thank you for the feedback. |
|
Looks good to me. Had to convince myself that it was ok to send a media component without the bitrate, but after following the logic and consulting the specs it looks like this is ok. I also noticed that update_media_component function fixes the MediaType of the media component as I also note that the code doesn't use the |
Co-authored-by: Richard Bradbury <rjb1000@users.noreply.github.com>
Co-authored-by: Richard Bradbury <rjb1000@users.noreply.github.com>
b3e0ddc to
fa910f5
Compare
yes, in
everything else get rejected: 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;
break;
case OpenAPI_media_type_VIDEO:
qos_index = OGS_QOS_INDEX_2;
break;
case OpenAPI_media_type_CONTROL:
qos_index = OGS_QOS_INDEX_5;
break;
default:
strerror = ogs_msprintf("[%s:%d] Unknown Media-Type [%d]",
pcf_ue->supi, sess->psi, media_component->media_type);
status = OGS_SBI_HTTP_STATUS_BAD_REQUEST;
goto cleanup;
}spec: NetworkAssistanceSession:
...
mediaType:
$ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/MediaType'
TS 29.514 MediaType:
description: Indicates the media type of a media component.
anyOf:
- type: string
enum:
- AUDIO
- VIDEO
- DATA
- APPLICATION
- CONTROL
- TEXT
- MESSAGE
- OTHER
- type: string@davidjwbbc As i understand only audio, video and control are implemented in Open5GS in the Branch we are using. |
Summary
NetworkAssistanceSession.requestedQoS has cardinality [0..1] and is therefore optional.
The code previously accessed subfields of requestedQoS without checking whether the object was present. When requestedQoS was omitted, this led to a NULL pointer dereference and caused the AF to crash.
Closes 2 Bugs Reported in #190