mirror of
https://github.com/open5gs/open5gs.git
synced 2025-10-23 07:41:57 +00:00
[AMF] Ensure AMF gracefully rejects registrations with no subscription slices (#3970)
Previously, malformed S-NSSAI parameters could trigger a fatal assertion in amf_update_allowed_nssai when the UE had zero slices in its subscription database. This patch introduces an explicit check for amf_ue->num_of_slice == 0, logs a clear error message including the UE’s SUPI, and returns false to reject the registration. The removed assertion prevents AMF crashes and ensures that other UEs continue to be served normally.
This commit is contained in:
@@ -2974,6 +2974,12 @@ bool amf_update_allowed_nssai(amf_ue_t *amf_ue)
|
||||
amf_ue->rejected_nssai.num_of_s_nssai = 0;
|
||||
|
||||
if (amf_ue->requested_nssai.num_of_s_nssai) {
|
||||
|
||||
if (amf_ue->num_of_slice == 0) {
|
||||
ogs_error("[%s] No Slice in Subscription DB", amf_ue->supi);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (i = 0; i < amf_ue->requested_nssai.num_of_s_nssai; i++) {
|
||||
ogs_slice_data_t *slice = NULL;
|
||||
ogs_nas_s_nssai_ie_t *requested =
|
||||
@@ -2986,7 +2992,6 @@ bool amf_update_allowed_nssai(amf_ue_t *amf_ue)
|
||||
s_nssai[amf_ue->rejected_nssai.num_of_s_nssai];
|
||||
bool ta_supported = false;
|
||||
|
||||
ogs_assert(amf_ue->num_of_slice);
|
||||
slice = ogs_slice_find_by_s_nssai(
|
||||
amf_ue->slice, amf_ue->num_of_slice,
|
||||
(ogs_s_nssai_t *)requested);
|
||||
|
Reference in New Issue
Block a user