修复fci内存越界问题

This commit is contained in:
xia-chu 2021-04-28 13:55:00 +08:00
parent 26cd5660cd
commit ac55ae79fb

View File

@ -499,9 +499,9 @@ std::shared_ptr<RtcpFB> RtcpFB::create_l(RtcpType type, int fmt, const void *fci
} }
auto real_size = sizeof(RtcpFB) + fci_len; auto real_size = sizeof(RtcpFB) + fci_len;
auto bytes = alignSize(real_size); auto bytes = alignSize(real_size);
auto ptr = (RtcpRR *) new char[bytes]; auto ptr = (RtcpFB *) new char[bytes];
if (fci && fci_len) { if (fci && fci_len) {
memcpy(ptr + sizeof(RtcpFB), fci, fci_len); memcpy((char *)ptr + sizeof(RtcpFB), fci, fci_len);
} }
setupHeader(ptr, type, fmt, bytes); setupHeader(ptr, type, fmt, bytes);
setupPadding(ptr, bytes - real_size); setupPadding(ptr, bytes - real_size);