diff --git a/jni/redphone/RtpAudioReceiver.cpp b/jni/redphone/RtpAudioReceiver.cpp index 616dd525c9..12e111d06e 100644 --- a/jni/redphone/RtpAudioReceiver.cpp +++ b/jni/redphone/RtpAudioReceiver.cpp @@ -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) { diff --git a/jni/redphone/RtpPacket.h b/jni/redphone/RtpPacket.h index 2a06563945..bacd251490 100644 --- a/jni/redphone/RtpPacket.h +++ b/jni/redphone/RtpPacket.h @@ -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(); diff --git a/libs/armeabi-v7a/libredphone-audio.so b/libs/armeabi-v7a/libredphone-audio.so index a8241c8e54..c08d1a5733 100755 Binary files a/libs/armeabi-v7a/libredphone-audio.so and b/libs/armeabi-v7a/libredphone-audio.so differ diff --git a/libs/armeabi/libredphone-audio.so b/libs/armeabi/libredphone-audio.so index 7949956a03..d607b23f1d 100755 Binary files a/libs/armeabi/libredphone-audio.so and b/libs/armeabi/libredphone-audio.so differ diff --git a/libs/x86/libredphone-audio.so b/libs/x86/libredphone-audio.so index 597cc96c1c..0aa7c7189c 100755 Binary files a/libs/x86/libredphone-audio.so and b/libs/x86/libredphone-audio.so differ