Changeset 4322


Ignore:
Timestamp:
Jan 17, 2013 10:09:09 AM (7 years ago)
Author:
bennylp
Message:

Really fix #1609 after better understanding about the problem. This changeset:

  • undo r4320
  • remove the reliance on NULL termination in sip_auth_client.c
  • add the NULL termination when printing tel: URI just in case other components use it
Location:
pjproject/trunk/pjsip/src/pjsip
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip/sip_auth_client.c

    r4320 r4322  
    921921         */ 
    922922        unsigned i; 
    923         char *uri_str; 
    924         int len; 
    925  
    926         uri_str = (char*)pj_pool_alloc(tdata->pool, PJSIP_MAX_URL_SIZE+1); 
    927         len = pjsip_uri_print(PJSIP_URI_IN_REQ_URI, tdata->msg->line.req.uri, 
    928                               uri_str, PJSIP_MAX_URL_SIZE); 
    929         if (len < 1 || len >= PJSIP_MAX_URL_SIZE) 
     923        pj_str_t uri; 
     924 
     925        uri.ptr = (char*)pj_pool_alloc(tdata->pool, PJSIP_MAX_URL_SIZE); 
     926        uri.slen = pjsip_uri_print(PJSIP_URI_IN_REQ_URI, 
     927                                  tdata->msg->line.req.uri, 
     928                                   uri.ptr, PJSIP_MAX_URL_SIZE); 
     929        if (uri.slen < 1 || uri.slen >= PJSIP_MAX_URL_SIZE) 
    930930            return PJSIP_EURITOOLONG; 
    931  
    932         /* https://trac.pjsip.org/repos/ticket/1609 */ 
    933         uri_str[len] = '\0'; 
    934931 
    935932        for (i=0; i<sess->cred_cnt; ++i) { 
     
    950947                pj_strdup(tdata->pool, &hs->credential.digest.realm, 
    951948                          &c->realm); 
    952                 pj_strdup2(tdata->pool, &hs->credential.digest.uri, 
    953                            uri_str); 
     949                pj_strdup(tdata->pool, &hs->credential.digest.uri, &uri); 
    954950                pj_strdup(tdata->pool, &hs->credential.digest.algorithm, 
    955951                          &sess->pref.algorithm); 
  • pjproject/trunk/pjsip/src/pjsip/sip_tel_uri.c

    r3553 r4322  
    183183    int printed; 
    184184    char *startbuf = buf; 
    185     char *endbuf = buf+size; 
     185    char *endbuf = buf+size-1; 
    186186    const pjsip_parser_const_t *pc = pjsip_parser_const(); 
    187187 
     
    217217        return -1; 
    218218    buf += printed; 
     219 
     220    *buf = '\0'; 
    219221 
    220222    return (buf-startbuf); 
Note: See TracChangeset for help on using the changeset viewer.