open5gs/lib/sbi
Sukchan Lee 769b6d24ac sbi: prevent AMF abort on malformed multipart SBI requests
The AMF could abort when processing malformed or oversized multipart
SBI requests due to an assertion triggered in the multipart parser
callback.

When the parser encountered an overflow condition while assembling
multipart part data, `on_part_data()` executed `ogs_assert_if_reached()`,
causing the AMF process to terminate. This allowed malformed HTTP/2
multipart requests to trigger a denial-of-service condition.

This patch replaces the assertion-based failure with graceful error
handling:

- Introduce `multipart_part_data_t` and explicit parser state tracking.
- Add `parse_error` flag to propagate parsing failures.
- Validate the result of `multipart_parser_execute()`.
- Reject malformed multipart payloads instead of aborting.
- Replace fatal assertions with error handling and proper cleanup.
- Add centralized cleanup via `multipart_parser_data_free()`.

As a result, malformed or oversized multipart bodies are now rejected
with an error, while the AMF process remains operational.

Issues: #4290
2026-03-08 19:59:17 +09:00
..
contrib Add only one 5GC scenario (call-flow) 2020-06-17 01:22:28 -04:00
custom [SBI] Fix parsing and serialization of _links "item" array (#3897) 2025-05-18 14:32:39 +09:00
openapi [UDM][UDR] Add support for dataset-names resource (#4105) 2025-10-17 09:16:28 +09:00
support [UDM][UDR] Add support for dataset-names resource (#4105) 2025-10-17 09:16:28 +09:00
client.c [SBI] fix compiler errors when using latest libcurl 2025-11-13 06:40:18 +09:00
client.h Merge branch 'main' into home-routed 2025-04-06 18:36:57 +09:00
context.c amf: snapshot RAN-UE ID in SBI transaction to avoid race during SM Context Update 2026-03-05 22:30:31 +09:00
context.h amf: snapshot RAN-UE ID in SBI transaction to avoid race during SM Context Update 2026-03-05 22:30:31 +09:00
conv.c Merge branch 'main' into home-routed 2025-02-09 11:15:55 +09:00
conv.h [NRF] Implemented PLMN list update handling in nrf_nnrf_handle_nf_update (#3566) 2024-12-26 14:38:00 +09:00
meson.build [SBI] Fixed openapitools MAP generation (#2103) 2023-02-26 10:01:08 +09:00
message.c sbi: prevent AMF abort on malformed multipart SBI requests 2026-03-08 19:59:17 +09:00
message.h Remove Duplicated Code 2025-11-15 10:39:24 +09:00
mhd-server.c [SBI] Prevent UAF/double-free by using pool ID in timer callbacks (#4074) 2025-09-17 21:50:47 +09:00
nf-sm.c sbi: cleanup NRF subscriptions before NF re-registration 2026-02-12 16:17:49 +09:00
nf-sm.h [SBI] SearchResult.validityPeriod 3600->30s (#3210) 2024-05-17 14:54:32 +09:00
nghttp2-server.c sbi: add HTTP body size limit in nghttp2 server 2026-02-13 11:23:14 +09:00
nnrf-build.c Merge branch 'main' into home-routed 2025-04-06 18:36:57 +09:00
nnrf-build.h Merge branch 'main' into home-routed 2025-04-06 18:36:57 +09:00
nnrf-handler.c sbi: Prevent NFProfile overflow in SMF/AMF info parsing 2026-02-13 17:20:20 +09:00
nnrf-handler.h [SBI] Added Handler for Subscription PATCH (#2152) 2023-03-12 22:06:19 +09:00
nnrf-path.c Merge branch 'main' into home-routed 2025-04-06 18:36:57 +09:00
nnrf-path.h Merge branch 'main' into home-routed 2025-04-06 18:36:57 +09:00
ogs-sbi.h [UDM][UDR] Add support for dataset-names resource (#4105) 2025-10-17 09:16:28 +09:00
path.c [SBI] Fix double-free 2026-01-31 20:17:58 +09:00
path.h Merge branch 'main' into home-routed 2025-01-19 17:11:20 +09:00
server.c Merge branch 'main' into home-routed 2025-04-06 18:36:57 +09:00
server.h Merge branch 'main' into home-routed 2025-04-06 18:36:57 +09:00
timer.c [SBI] Added Handler for Subscription PATCH (#2152) 2023-03-12 22:06:19 +09:00
timer.h [SBI] Added Handler for Subscription PATCH (#2152) 2023-03-12 22:06:19 +09:00
types.c [AMF] API to add or remove PLMNs Dynamically (#4186) 2025-12-03 21:32:59 +09:00
types.h [AMF] API to add or remove PLMNs Dynamically (#4186) 2025-12-03 21:32:59 +09:00
yuarel.c Added NRF 2020-05-18 17:00:37 -04:00
yuarel.h Added NRF 2020-05-18 17:00:37 -04:00