Unverified 提交 d439cbb5 authored 作者: José Luis Millán's avatar José Luis Millán 提交者: GitHub

SctpAssociation: fix memory violation (#943)

* SctpAssociation: fix memory violation

...when sctp debug tag is set, for SCTP_ASSOC_CHANGE notification.

Closes #904

We were taking the 'sn_assoc_change.sac_info' length wrongly, unlike
for the other notifications we are logging.

- usrsctp code where the notification is created:
https://github.com/sctplab/usrsctp/blob/master/usrsctplib/netinet/sctputil.c#L3296

- Example code where this length is retrieved correctly:
https://github.com/sctplab/usrsctp/blob/master/programs/rtcweb.c#L871

* Update CHANGELOG

* normalize CHANGELOG

* be consistent with struct size retrieval
上级 0a67781e
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
* Fix some libwebrtc issues (PR #944). * Fix some libwebrtc issues (PR #944).
* Tests: Normalize hexadecimal data representation (PR #945). * Tests: Normalize hexadecimal data representation (PR #945).
* Update NPM deps. * Update NPM deps.
* `SctpAssociation`: Fix memory violation (PR #943).
### 3.10.12 ### 3.10.12
......
...@@ -772,7 +772,8 @@ namespace RTC ...@@ -772,7 +772,8 @@ namespace RTC
static const size_t BufferSize{ 1024 }; static const size_t BufferSize{ 1024 };
thread_local static char buffer[BufferSize]; thread_local static char buffer[BufferSize];
uint32_t len = notification->sn_header.sn_length; uint32_t len =
notification->sn_assoc_change.sac_length - sizeof(struct sctp_assoc_change);
for (uint32_t i{ 0 }; i < len; ++i) for (uint32_t i{ 0 }; i < len; ++i)
{ {
...@@ -840,7 +841,8 @@ namespace RTC ...@@ -840,7 +841,8 @@ namespace RTC
static const size_t BufferSize{ 1024 }; static const size_t BufferSize{ 1024 };
thread_local static char buffer[BufferSize]; thread_local static char buffer[BufferSize];
uint32_t len = notification->sn_header.sn_length; uint32_t len =
notification->sn_assoc_change.sac_length - sizeof(struct sctp_assoc_change);
for (uint32_t i{ 0 }; i < len; ++i) for (uint32_t i{ 0 }; i < len; ++i)
{ {
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论