[S] Change in libosmocore[master]: gb: ns2: clamp embedded NS PDU to msgb tailroom
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmocore/+/44138?usp=email to look at the new patch set (#2). Change subject: gb: ns2: clamp embedded NS PDU to msgb tailroom ...................................................................... gb: ns2: clamp embedded NS PDU to msgb tailroom Per TS 48.016 9.2.7.2 an NS-STATUS PDU embeds the PDU that caused the error. reject_status_msg() copies it in without any length check, and ns2_tx_status() clamps it against nsvc->bind->mtu only, not against the space left in the reply msgb. For an NS-over-IP bind that MTU is 65527 (gprs_ns2_udp.c:344), while the STATUS msgb from ns2_msgb_alloc() offers 3052 usable bytes (NS_ALLOC_SIZE 3072 minus NS_ALLOC_HEADROOM 20), of which 3048 remain after the NS header and the Cause IE. A received PDU of 3046 bytes or more therefore makes msgb_tvlv_put() -> msgb_put() hit MSGB_ABORT, which aborts the process. No NS-VC, handshake or credentials are needed to reach either site. Clamp against the msgb tailroom in both places, and use a saturating clamp instead of a subtraction on an unsigned (the old form could underflow if the MTU were smaller than the message built so far). bssgp_tx_status() in the same tree already does this correctly via OSMO_MIN(..., msgb_tailroom(msg) - 3). Fixes: 6a161497cfd8cacfef10c2e81cff85a45447e107 Change-Id: Iac1c5c15875f30f34d0f7e9fc74264530a02b6ae --- M src/gb/gprs_ns2.c M src/gb/gprs_ns2_message.c 2 files changed, 28 insertions(+), 8 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/38/44138/2 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/44138?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Iac1c5c15875f30f34d0f7e9fc74264530a02b6ae Gerrit-Change-Number: 44138 Gerrit-PatchSet: 2 Gerrit-Owner: ws1004 <ws1004@kakao.com> Gerrit-Reviewer: Jenkins Builder
participants (1)
-
ws1004