open5gs/lib/proto
Sukchan Lee 6a29f11115 proto: Prevent SMF crash on malformed PCO/EPCO during parsing
ogs_pco_parse() previously relied on ogs_assert() to verify the bounds
of Protocol/Container fields while parsing PCO/EPCO data. If the outer
PCO/EPCO length was inconsistent with the internal container encoding
(e.g., truncated Container-ID, Container-Length, or container data),
the assert would trigger and terminate the process.

Because PCO/EPCO is derived from UE-supplied NAS messages (e.g.,
PDU Session Establishment Request), a malformed EPCO IE could trigger
a remote SMF crash, resulting in a denial-of-service condition.

This patch replaces the assert-based bounds checks with explicit
runtime validation and returns an error when malformed or truncated
PCO/EPCO is detected. The SMF can then reject the request cleanly
instead of aborting.

Checks added:
- Validate minimum PCO/EPCO length before accessing header fields
- Verify Container-ID bounds
- Verify Container-Length bounds
- Verify container payload length
- Detect container count overflow beyond
  OGS_MAX_NUM_OF_PROTOCOL_OR_CONTAINER_ID

With these changes, malformed EPCO inputs are safely rejected and the
SMF remains operational.

Issues: #4341
2026-03-10 22:35:42 +09:00
..
conv.c lib/proto/conv: Introduce API ogs_ip_to_paa() 2024-01-06 07:44:14 +09:00
conv.h lib/proto/conv: Introduce API ogs_ip_to_paa() 2024-01-06 07:44:14 +09:00
event.c [SEPP] Initial Update for 5G Roaming (#2739) 2023-11-19 19:34:51 +09:00
event.h [SEPP] Initial Update for 5G Roaming (#2739) 2023-11-19 19:34:51 +09:00
meson.build Move src/../nf-sm.[ch] to lib/sbi/nf-sm.[ch] 2022-08-12 14:03:53 +09:00
ogs-proto.h [NRF] Fixed library load error 2022-08-26 10:57:11 +09:00
timer.c [SEPP] Initial Update for 5G Roaming (#2739) 2023-11-19 19:34:51 +09:00
timer.h [SEPP] Initial Update for 5G Roaming (#2739) 2023-11-19 19:34:51 +09:00
types.c proto: Prevent SMF crash on malformed PCO/EPCO during parsing 2026-03-10 22:35:42 +09:00
types.h Fix DNN Operator-Identifier format and refactor OI parsing for HR roaming interop 2025-12-06 22:23:34 +09:00