Drop malformed RTP packets

// FREEBIE
This commit is contained in:
Moxie Marlinspike 2016-09-12 10:43:08 -07:00
parent 85ea7e1bf4
commit 8f256fa285
5 changed files with 9 additions and 0 deletions

View File

@ -26,6 +26,11 @@ RtpPacket* RtpAudioReceiver::receive(char* encodedData, int encodedDataLen) {
return NULL;
}
if (received < RtpPacket::getMinimumSize()) {
__android_log_print(ANDROID_LOG_WARN, TAG, "recveived malformed packet!");
return NULL;
}
RtpPacket *packet = new RtpPacket(encodedData, received);
if (srtpStream.decrypt(*packet, sequenceCounter.convertNext(packet->getSequenceNumber())) != 0) {

View File

@ -21,6 +21,10 @@ public:
RtpPacket(char *payload, int payloadLen, int sequenceNumber, int timestamp);
~RtpPacket();
static int getMinimumSize() {
return sizeof(RtpHeader);
}
uint16_t getSequenceNumber();
int getPayloadType();
uint32_t getTimestamp();

Binary file not shown.

Binary file not shown.