[Opalvoip-svn] SF.net SVN: opalvoip:[28601] opal/branches/v3_10/src/rtp/pcapfile.cxx
Brought to you by:
csoutheren,
rjongbloed
From: <rjo...@us...> - 2012-11-27 00:45:33
|
Revision: 28601 http://opalvoip.svn.sourceforge.net/opalvoip/?rev=28601&view=rev Author: rjongbloed Date: 2012-11-27 00:45:27 +0000 (Tue, 27 Nov 2012) Log Message: ----------- Back ported fix for RTP player, incorrect size of some UDP packets. Need to use header field, not raw Ethernet frame size. Modified Paths: -------------- opal/branches/v3_10/src/rtp/pcapfile.cxx Modified: opal/branches/v3_10/src/rtp/pcapfile.cxx =================================================================== --- opal/branches/v3_10/src/rtp/pcapfile.cxx 2012-11-27 00:01:12 UTC (rev 28600) +++ opal/branches/v3_10/src/rtp/pcapfile.cxx 2012-11-27 00:45:27 UTC (rev 28601) @@ -200,8 +200,14 @@ if (GetDataLink(ip) != 0x800) // IPv4 return -1; + PINDEX totalLength = (ip[2]<<8)|ip[3]; // Total length of packet + if (totalLength > ip.GetSize()) { + PTRACE(2, "Truncated IP packet, expected " << totalLength << ", got " << ip.GetSize()); + return -1; + } + PINDEX headerLength = (ip[0]&0xf)*4; // low 4 bits in DWORDS, is this in bytes - payload.Attach(&ip[headerLength], ip.GetSize()-headerLength); + payload.Attach(&ip[headerLength], totalLength-headerLength); m_packetSrcIP = PIPSocket::Address(4, ip+12); if (!m_filterSrcIP.IsAny() && m_filterSrcIP != m_packetSrcIP) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |