pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/29540 )
Change subject: stream: Set proper msgb length when returning sctp_notification ......................................................................
stream: Set proper msgb length when returning sctp_notification
This allows the user to properly check the size of the content in case the struct ABI changes. -EAGAIN is still returned to avoid older users of the API reading SCTP notifications as user data.
Change-Id: I95e2457498fd8e0d790d221cb97695ace0dd673e --- M src/stream.c 1 file changed, 1 insertion(+), 0 deletions(-)
Approvals: Jenkins Builder: Verified neels: Looks good to me, but someone else must approve laforge: Looks good to me, approved
diff --git a/src/stream.c b/src/stream.c index b45b730..31aecc4 100644 --- a/src/stream.c +++ b/src/stream.c @@ -1476,6 +1476,7 @@ if (flags & MSG_NOTIFICATION) { union sctp_notification *notif = (union sctp_notification *)msgb_data(msg); LOGP(DLINP, LOGL_DEBUG, "NOTIFICATION %u flags=0x%x\n", notif->sn_header.sn_type, notif->sn_header.sn_flags); + msgb_put(msg, sizeof(union sctp_notification)); msgb_sctp_msg_flags(msg) = OSMO_STREAM_SCTP_MSG_FLAGS_NOTIFICATION; switch (notif->sn_header.sn_type) { case SCTP_ASSOC_CHANGE: