mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
修复webrtc转发可能内存越界的bug: #2159
This commit is contained in:
parent
56ccd4332a
commit
f6a36180b4
@ -346,7 +346,7 @@ void WebRtcTransport::sendRtpPacket(const char *buf, int len, bool flush, void *
|
|||||||
auto pkt = _packet_pool.obtain2();
|
auto pkt = _packet_pool.obtain2();
|
||||||
// 预留rtx加入的两个字节
|
// 预留rtx加入的两个字节
|
||||||
pkt->setCapacity((size_t)len + SRTP_MAX_TRAILER_LEN + 2);
|
pkt->setCapacity((size_t)len + SRTP_MAX_TRAILER_LEN + 2);
|
||||||
pkt->assign(buf, len);
|
memcpy(pkt->data(), buf, len);
|
||||||
onBeforeEncryptRtp(pkt->data(), len, ctx);
|
onBeforeEncryptRtp(pkt->data(), len, ctx);
|
||||||
if (_srtp_session_send->EncryptRtp(reinterpret_cast<uint8_t *>(pkt->data()), &len)) {
|
if (_srtp_session_send->EncryptRtp(reinterpret_cast<uint8_t *>(pkt->data()), &len)) {
|
||||||
pkt->setSize(len);
|
pkt->setSize(len);
|
||||||
|
Loading…
Reference in New Issue
Block a user