[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:
Sukchan Lee
2025-07-09 21:24:26 +09:00
parent bca0a7b6e0
commit 345800ba94
5 changed files with 62 additions and 11 deletions

View File

@@ -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;
}