Changeset 1635


Ignore:
Timestamp:
Dec 17, 2007 12:16:08 PM (11 years ago)
Author:
bennylp
Message:

Fixed errors in SDP: 1) scanner is not initialized before pjmedia_sdp_parse() is called, 2) added null termination in attribute for more robustness

File:
1 edited

Legend:

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

    r1417 r1635  
    249249    PJ_ASSERT_RETURN(attr->value.slen != 0, PJMEDIA_SDP_EINATTR); 
    250250 
     251    init_sdp_parser(); 
     252 
    251253    /* Check if input is null terminated, and null terminate if 
    252254     * necessary. Unfortunately this may crash the application if 
     
    367369    PJ_ASSERT_RETURN(pj_strcmp2(&attr->name, "rtcp")==0, PJ_EINVALIDOP); 
    368370 
     371    init_sdp_parser(); 
     372 
    369373    /* fmtp BNF: 
    370374     *  a=rtcp:<port> [nettype addrtype address] 
     
    464468    attr->value.slen = len; 
    465469    attr->value.ptr = (char*) pj_pool_alloc(pool, attr->value.slen); 
    466     pj_memcpy(attr->value.ptr, tempbuf, attr->value.slen); 
     470    pj_memcpy(attr->value.ptr, tempbuf, attr->value.slen+1); 
    467471 
    468472    *p_attr = attr; 
Note: See TracChangeset for help on using the changeset viewer.