open5gs/lib/nas
Sukchan Lee 76d2237c0e
Some checks are pending
Meson Continuous Integration / Build and Test on Ubuntu Latest (push) Waiting to run
nas: fix uninitialized read in NAS DNN/APN decode
ogs_fqdn_parse() returns -EINVAL on invalid FQDN encoding, but the DNN
and APN decoders stored the result directly into the uint8_t length
field. The negative value was truncated (-22 -> 234), so the
"if (length > 0)" guard passed and ogs_cpystrn() copied up to 101 bytes
from an uninitialized stack buffer that ogs_fqdn_parse() never wrote.

The guard was written when ogs_fqdn_parse() returned 0 on failure; the
later switch to -EINVAL broke it via the unsigned truncation.

Capture the return value in a signed int, take the error branch on
negative/zero, and assign to length only on success. Applied to both
ogs_nas_5gs_decode_dnn and ogs_nas_eps_decode_access_point_name via the
support/type-list.py templates; generated ies.c regenerated.

Found by OSS-Fuzz (nas_5gs_message_fuzz, MSan).

Issues: #4645
2026-06-27 11:40:33 +09:00
..
5gs nas: fix uninitialized read in NAS DNN/APN decode 2026-06-27 11:40:33 +09:00
common nas: update EPS and 5GS NAS messages to Rel-19 2026-06-15 16:20:14 +09:00
eps nas: fix uninitialized read in NAS DNN/APN decode 2026-06-27 11:40:33 +09:00
meson.build NAS-5GS is added 2020-05-21 21:24:21 -04:00