- format + fix invalid memory access
This commit is contained in:
parent
9d79c01be0
commit
e342abe2f5
|
|
@ -36,12 +36,12 @@
|
||||||
#include "rtperrors.h"
|
#include "rtperrors.h"
|
||||||
#include "rtprawpacket.h"
|
#include "rtprawpacket.h"
|
||||||
#if ! (defined(WIN32) || defined(_WIN32_WCE))
|
#if ! (defined(WIN32) || defined(_WIN32_WCE))
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
|
|
||||||
#ifdef RTPDEBUG
|
#ifdef RTPDEBUG
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif // RTPDEBUG
|
#endif // RTPDEBUG
|
||||||
|
|
||||||
#include "rtpdebug.h"
|
#include "rtpdebug.h"
|
||||||
|
|
@ -152,6 +152,8 @@ int RTPPacket::ParseRawPacket(RTPRawPacket &rawpack)
|
||||||
|
|
||||||
csrccount = rtpheader->csrccount;
|
csrccount = rtpheader->csrccount;
|
||||||
payloadoffset = sizeof(RTPHeader)+(int)(csrccount*sizeof(uint32_t));
|
payloadoffset = sizeof(RTPHeader)+(int)(csrccount*sizeof(uint32_t));
|
||||||
|
if ((size_t)payloadoffset > packetlen)
|
||||||
|
return ERR_RTP_PACKET_INVALIDPACKET;
|
||||||
|
|
||||||
if (rtpheader->padding) // adjust payload length to take padding into account
|
if (rtpheader->padding) // adjust payload length to take padding into account
|
||||||
{
|
{
|
||||||
|
|
@ -167,6 +169,8 @@ int RTPPacket::ParseRawPacket(RTPRawPacket &rawpack)
|
||||||
{
|
{
|
||||||
rtpextheader = (RTPExtensionHeader *)(packetbytes+payloadoffset);
|
rtpextheader = (RTPExtensionHeader *)(packetbytes+payloadoffset);
|
||||||
payloadoffset += sizeof(RTPExtensionHeader);
|
payloadoffset += sizeof(RTPExtensionHeader);
|
||||||
|
if ((size_t)payloadoffset > packetlen)
|
||||||
|
return ERR_RTP_PACKET_INVALIDPACKET;
|
||||||
exthdrlen = ntohs(rtpextheader->length);
|
exthdrlen = ntohs(rtpextheader->length);
|
||||||
payloadoffset += ((int)exthdrlen)*sizeof(uint32_t);
|
payloadoffset += ((int)exthdrlen)*sizeof(uint32_t);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue