Changeset 5639 for pjproject


Ignore:
Timestamp:
Aug 2, 2017 10:44:10 AM (2 years ago)
Author:
riza
Message:

Fix #2035: Make sure transport SRTP buf size is sufficient before calling
srtp_protect() and srtp_protect_rtcp().

Location:
pjproject/trunk/pjmedia
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/include/pjmedia/config.h

    r5619 r5639  
    13801380 * PJMEDIA_MAX_MTU. 
    13811381 * 
    1382  * Default: (PJMEDIA_MAX_MTU - 100) 
    1383  */ 
    1384 #ifndef PJMEDIA_MAX_VID_PAYLOAD_SIZE                     
    1385 #  define PJMEDIA_MAX_VID_PAYLOAD_SIZE          (PJMEDIA_MAX_MTU - 100) 
     1382 * Default: (PJMEDIA_MAX_MTU - SRTP_MAX_TRAILER_LEN) if SRTP is enabled,  
     1383 *          otherwise (PJMEDIA_MAX_MTU - 100) 
     1384 */ 
     1385#ifndef PJMEDIA_MAX_VID_PAYLOAD_SIZE 
     1386/* Include SRTP_MAX_TRAILER_LEN definition. */ 
     1387#   if defined(PJMEDIA_EXTERNAL_SRTP) && (PJMEDIA_EXTERNAL_SRTP != 0) 
     1388#       include "srtp/srtp.h" 
     1389#   elif (defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)) 
     1390#       include "../../third_party/srtp/include/srtp.h" 
     1391#   endif 
     1392 
     1393#   if defined(SRTP_MAX_TRAILER_LEN) 
     1394#       define PJMEDIA_MAX_VID_PAYLOAD_SIZE     (PJMEDIA_MAX_MTU - \ 
     1395                                                 SRTP_MAX_TRAILER_LEN) 
     1396#   else 
     1397#       define PJMEDIA_MAX_VID_PAYLOAD_SIZE     (PJMEDIA_MAX_MTU - 100) 
     1398#   endif 
    13861399#endif 
    13871400 
  • pjproject/trunk/pjmedia/src/pjmedia/transport_srtp.c

    r5635 r5639  
    6969 
    7070#define DEACTIVATE_MEDIA(pool, m)   pjmedia_sdp_media_deactivate(pool, m) 
     71 
     72#ifdef SRTP_MAX_TRAILER_LEN 
     73#   define MAX_TRAILER_LEN SRTP_MAX_TRAILER_LEN 
     74#else 
     75#   define MAX_TRAILER_LEN 10 
     76#endif 
    7177 
    7278static const pj_str_t ID_RTP_AVP  = { "RTP/AVP", 7 }; 
     
    10631069        return pjmedia_transport_send_rtp(srtp->member_tp, pkt, size); 
    10641070 
    1065     if (size > sizeof(srtp->rtp_tx_buffer) - 10) 
     1071    if (size > sizeof(srtp->rtp_tx_buffer) - MAX_TRAILER_LEN) 
    10661072        return PJ_ETOOBIG; 
    10671073 
     
    11091115    } 
    11101116 
    1111     if (size > sizeof(srtp->rtcp_tx_buffer) - 10) 
     1117    if (size > sizeof(srtp->rtcp_tx_buffer) - MAX_TRAILER_LEN) 
    11121118        return PJ_ETOOBIG; 
    11131119 
Note: See TracChangeset for help on using the changeset viewer.