Changeset 587 for pjproject


Ignore:
Timestamp:
Jul 5, 2006 9:42:45 PM (18 years ago)
Author:
bennylp
Message:

Fixed SIP parsing bugs when in-place escaping is enabled

Location:
pjproject/trunk/pjsip/src
Files:
2 edited

Legend:

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

    r583 r587  
    363363    status = pj_cis_dup(&pjsip_PASSWD_SPEC_ESC, &pjsip_PASSWD_SPEC); 
    364364    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); 
    365     pj_cis_del_str( &pjsip_PASSWD_SPEC, ESCAPED); 
     365    pj_cis_del_str( &pjsip_PASSWD_SPEC_ESC, ESCAPED); 
    366366 
    367367    status = pj_cis_init(&cis_buf, &pjsip_PROBE_USER_HOST_SPEC); 
     
    11051105        { 
    11061106            parser_get_and_unescape(scanner, pool, &pjsip_HDR_CHAR_SPEC, 
    1107                                     &pjsip_HDR_CHAR_SPEC, hvalue); 
     1107                                    &pjsip_HDR_CHAR_SPEC_ESC, hvalue); 
    11081108        } 
    11091109    } 
  • pjproject/trunk/pjsip/src/test-pjsip/uri_test.c

    r582 r587  
    686686    pj_status_t status; 
    687687    int len; 
     688    char *input; 
    688689    pjsip_uri *parsed_uri, *ref_uri; 
    689690    pj_str_t s1 = {NULL, 0}, s2 = {NULL, 0}; 
    690691    pj_timestamp t1, t2; 
    691692 
    692     entry->len = pj_native_strlen(entry->str); 
     693    if (entry->len == 0) 
     694        entry->len = pj_native_strlen(entry->str); 
     695 
     696#if defined(PJSIP_UNESCAPE_IN_PLACE) && PJSIP_UNESCAPE_IN_PLACE!=0 
     697    input = pj_pool_alloc(pool, entry->len + 1); 
     698    pj_memcpy(input, entry->str, entry->len); 
     699    input[entry->len] = '\0'; 
     700#else 
     701    input = entry->str; 
     702#endif 
    693703 
    694704    /* Parse URI text. */ 
    695705    pj_get_timestamp(&t1); 
    696706    var.parse_len = var.parse_len + entry->len; 
    697     parsed_uri = pjsip_parse_uri(pool, entry->str, entry->len, 0); 
     707    parsed_uri = pjsip_parse_uri(pool, input, entry->len, 0); 
    698708    if (!parsed_uri) { 
    699709        /* Parsing failed. If the entry says that this is expected, then 
     
    704714            PJ_LOG(3,(THIS_FILE, "   uri parse error!\n" 
    705715                                 "   uri='%s'\n", 
    706                                  entry->str)); 
     716                                 input)); 
    707717        } 
    708718        goto on_return; 
Note: See TracChangeset for help on using the changeset viewer.