mirror of
https://github.com/open5gs/open5gs.git
synced 2025-11-02 13:03:31 +00:00
[SMF] Improve robustness of PCO parsing and building by replacing fatal assertions with error handling (#3969)
Previously, malformed Protocol Configuration Options (PCO) data would trigger ogs_assert failures in both the generic parser and SMF build routines, causing the SMF process to abort unconditionally. This commit replaces those fatal assertions with conditional checks: In ogs_pco_parse(), switch from ogs_assert(size == data_len) to ogs_expect(size == data_len), allowing the function to return gracefully. In SMF's PCO build (smf_pco_build) and all downstream build paths (including GN, GSM, S5C modules), replace ogs_assert(pco_len > 0) with explicit if (pco_len <= 0) checks that: Ensure that malformed or incomplete PCOs no longer crash the process, but instead are handled cleanly so the network function can continue operating.
This commit is contained in:
@@ -480,7 +480,7 @@ int ogs_pco_parse(ogs_pco_t *pco, unsigned char *data, int data_len)
|
||||
i++;
|
||||
}
|
||||
pco->num_of_id = i;
|
||||
ogs_assert(size == data_len);
|
||||
ogs_expect(size == data_len);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user