Changeset 3325


Ignore:
Timestamp:
Sep 28, 2010 8:26:51 AM (11 years ago)
Author:
nanang
Message:

Fix #1135: added RTP padding checks and RTP payload length adjustment according to padding length.

Payload padding in outgoing RTP investigation results:

  • the RTP does not specify RTP payload alignment.
  • most codecs also do not specify RTP payload alignment, usually only octet-alignment is specified and this seems to be done.
  • SRTP, RFC3711 states:
    • None of the pre-defined SRTP encryption transforms uses any padding; for these, the RTP and SRTP payload sizes match exactly.
    • Message authentication codes define their own padding.
    • Encryption transforms that use padding are vulnerable to subtle attacks, especially when message authentication is not used.

So, currently payload padding in outgoing RTP is not necessary.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/rtp.c

    r2904 r3325  
    181181    *payload = ((pj_uint8_t*)pkt) + offset; 
    182182    *payloadlen = pkt_len - offset; 
     183  
     184    /* Remove payload padding if any */ 
     185    if ((*hdr)->p && *payloadlen > 0) { 
     186        pj_uint8_t pad_len; 
     187 
     188        pad_len = ((pj_uint8_t*)(*payload))[*payloadlen - 1]; 
     189        if (pad_len <= *payloadlen) 
     190            *payloadlen -= pad_len; 
     191    } 
    183192 
    184193    return PJ_SUCCESS; 
Note: See TracChangeset for help on using the changeset viewer.