Changeset 2433 for pjproject/trunk


Ignore:
Timestamp:
Jan 28, 2009 2:17:14 PM (16 years ago)
Author:
bennylp
Message:

Continuation of ticket #704: error in the test if PJSIP_UNESCAPE_IN_PLACE is set to 1 (thanks Michael Broughton for the report)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/test-pjsip/msg_test.c

    r2428 r2433  
    825825    char *hname; 
    826826    char *hshort_name; 
    827     char hcontent[1024]; 
     827    char *hcontent; 
    828828    int  (*test)(pjsip_hdr*); 
    829829    unsigned flags; 
     
    17351735        pjsip_hdr *parsed_hdr1=NULL, *parsed_hdr2=NULL; 
    17361736        char *input, *output; 
     1737#if defined(PJSIP_UNESCAPE_IN_PLACE) && PJSIP_UNESCAPE_IN_PLACE!=0 
     1738        static char hcontent[1024]; 
     1739#else 
     1740        char *hcontent; 
     1741#endif 
    17371742        int rc; 
    17381743 
     
    17421747        hname = pj_str(test->hname); 
    17431748        len = strlen(test->hcontent); 
     1749#if defined(PJSIP_UNESCAPE_IN_PLACE) && PJSIP_UNESCAPE_IN_PLACE!=0 
     1750        PJ_ASSERT_RETURN(len < sizeof(hcontent), PJSIP_EMSGTOOLONG); 
     1751        strcpy(hcontent, test->hcontent); 
     1752#else 
     1753        hcontent = test->hcontent; 
     1754#endif 
     1755         
    17441756        parsed_hdr1 = (pjsip_hdr*) pjsip_parse_hdr(pool, &hname,  
    1745                                                    test->hcontent, len,  
     1757                                                   hcontent, len,  
    17461758                                                   &parsed_len); 
    17471759        if (parsed_hdr1 == NULL) { 
     
    17661778            hname = pj_str(test->hshort_name); 
    17671779            len = strlen(test->hcontent); 
    1768             parsed_hdr2 = (pjsip_hdr*) pjsip_parse_hdr(pool, &hname, test->hcontent, len, &parsed_len); 
     1780#if defined(PJSIP_UNESCAPE_IN_PLACE) && PJSIP_UNESCAPE_IN_PLACE!=0 
     1781            PJ_ASSERT_RETURN(len < sizeof(hcontent), PJSIP_EMSGTOOLONG); 
     1782            strcpy(hcontent, test->hcontent); 
     1783#else 
     1784            hcontent = test->hcontent; 
     1785#endif 
     1786 
     1787            parsed_hdr2 = (pjsip_hdr*) pjsip_parse_hdr(pool, &hname, hcontent, len, &parsed_len); 
    17691788            if (parsed_hdr2 == NULL) { 
    17701789                PJ_LOG(3,(THIS_FILE, "    error parsing header %s: %s", test->hshort_name, test->hcontent)); 
Note: See TracChangeset for help on using the changeset viewer.