Changeset 5106


Ignore:
Timestamp:
Jun 12, 2015 3:03:48 AM (9 years ago)
Author:
riza
Message:

Misc (re #1843): Add index checking to some SDP attr operations. These operations use count parameter as index doesn't check the value which might lead to crash if the count param exceed PJMEDIA_MAX_SDP_ATTR.

File:
1 edited

Legend:

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

    r4613 r5106  
    145145    unsigned c_pt = 0xFFFF; 
    146146 
     147    PJ_ASSERT_RETURN(count < PJMEDIA_MAX_SDP_ATTR, NULL); 
     148 
    147149    if (c_fmt) 
    148150        c_pt = pj_strtoul(c_fmt); 
     
    200202 
    201203    PJ_ASSERT_RETURN(count && attr_array && name, PJ_EINVAL); 
     204    PJ_ASSERT_RETURN(*count < PJMEDIA_MAX_SDP_ATTR, PJ_ETOOMANY); 
    202205 
    203206    attr_name.ptr = (char*)name; 
     
    226229 
    227230    PJ_ASSERT_RETURN(count && attr_array && attr, PJ_EINVAL); 
     231    PJ_ASSERT_RETURN(*count < PJMEDIA_MAX_SDP_ATTR, PJ_ETOOMANY); 
    228232 
    229233    for (i=0; i<*count; ) { 
Note: See TracChangeset for help on using the changeset viewer.