Fixed bug in RTCP: packing error causing size mismatch when compiled with MSVC

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@382 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
Benny Prijono 2006-04-04 21:39:10 +00:00
parent 9a0eab59c8
commit 46ca996b91
2 changed files with 10 additions and 3 deletions

View File

@ -37,6 +37,8 @@ PJ_BEGIN_DECL
* @{
*/
#pragma pack(1)
/**
* RTCP sender report.
*/
@ -100,7 +102,7 @@ struct pjmedia_rtcp_common
unsigned version:2; /**< packet type */
unsigned pt:8; /**< payload type */
#endif
pj_uint16_t length; /**< packet length */
unsigned length:16; /**< packet length */
};
/**
@ -124,6 +126,9 @@ struct pjmedia_rtcp_pkt
typedef struct pjmedia_rtcp_pkt pjmedia_rtcp_pkt;
#pragma pack()
/**
* NTP time representation.
*/

View File

@ -1105,8 +1105,10 @@ static int media_thread(void *arg)
if (status != PJ_SUCCESS)
app_perror(THIS_FILE, "Error receiving RTCP packet", status);
else {
if (size > sizeof(strm->rem_rtcp)) {
PJ_LOG(3,(THIS_FILE, "Error: RTCP packet too large"));
if (size != sizeof(strm->rem_rtcp)) {
PJ_LOG(3,(THIS_FILE, "Error: RTCP packet size mismatch "
"(recv %d bytes, expecting %d)",
size, sizeof(strm->rem_rtcp)));
status = -1;
} else {
pj_memcpy(&strm->rem_rtcp, packet, size);