diff options
author | Benny Prijono <bennylp@teluu.com> | 2009-03-23 13:26:00 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2009-03-23 13:26:00 +0000 |
commit | bd221ecd3671724c412284f22e29f5fa425c7645 (patch) | |
tree | 5b5bc979ba7127016ac0621c59f50b7d2ddbcaae /pjsip | |
parent | 3d4eec995259c272dcee3275d3f533d4746e765e (diff) |
Ticket #705: backported changes from ticket #704
git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/1.0@2546 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r-- | pjsip/src/test-pjsip/msg_test.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/pjsip/src/test-pjsip/msg_test.c b/pjsip/src/test-pjsip/msg_test.c index 6aad1f8a..840c40ff 100644 --- a/pjsip/src/test-pjsip/msg_test.c +++ b/pjsip/src/test-pjsip/msg_test.c @@ -1866,6 +1866,11 @@ static int hdr_test(void) pj_pool_t *pool; pjsip_hdr *parsed_hdr1=NULL, *parsed_hdr2=NULL; char *input, *output; +#if defined(PJSIP_UNESCAPE_IN_PLACE) && PJSIP_UNESCAPE_IN_PLACE!=0 + static char hcontent[1024]; +#else + char *hcontent; +#endif int rc; pool = pjsip_endpt_create_pool(endpt, NULL, POOL_SIZE, POOL_SIZE); @@ -1873,8 +1878,15 @@ static int hdr_test(void) /* Parse the header */ hname = pj_str(test->hname); len = strlen(test->hcontent); +#if defined(PJSIP_UNESCAPE_IN_PLACE) && PJSIP_UNESCAPE_IN_PLACE!=0 + PJ_ASSERT_RETURN(len < sizeof(hcontent), PJSIP_EMSGTOOLONG); + strcpy(hcontent, test->hcontent); +#else + hcontent = test->hcontent; +#endif + parsed_hdr1 = (pjsip_hdr*) pjsip_parse_hdr(pool, &hname, - test->hcontent, len, + hcontent, len, &parsed_len); if (parsed_hdr1 == NULL) { if (test->flags & HDR_FLAG_PARSE_FAIL) { @@ -1897,7 +1909,14 @@ static int hdr_test(void) if (test->hshort_name) { hname = pj_str(test->hshort_name); len = strlen(test->hcontent); - parsed_hdr2 = (pjsip_hdr*) pjsip_parse_hdr(pool, &hname, test->hcontent, len, &parsed_len); +#if defined(PJSIP_UNESCAPE_IN_PLACE) && PJSIP_UNESCAPE_IN_PLACE!=0 + PJ_ASSERT_RETURN(len < sizeof(hcontent), PJSIP_EMSGTOOLONG); + strcpy(hcontent, test->hcontent); +#else + hcontent = test->hcontent; +#endif + + parsed_hdr2 = (pjsip_hdr*) pjsip_parse_hdr(pool, &hname, hcontent, len, &parsed_len); if (parsed_hdr2 == NULL) { PJ_LOG(3,(THIS_FILE, " error parsing header %s: %s", test->hshort_name, test->hcontent)); return -510; |