Ticket #832: ticket832.patch
File ticket832.patch, 4.3 KB (added by nanang, 15 years ago) |
---|
-
pjsip/src/test/msg_test.c
365 365 hdr2 = ref_msg->hdr.next; 366 366 367 367 while (hdr1 != &parsed_msg->hdr && hdr2 != &ref_msg->hdr) { 368 len = hdr1->vptr->print_on(hdr1, str1.ptr, BUFLEN);369 if (len < 1) {368 len = pjsip_hdr_print_on(hdr1, str1.ptr, BUFLEN); 369 if (len < 0) { 370 370 status = -40; 371 371 goto on_return; 372 372 } 373 373 str1.ptr[len] = '\0'; 374 374 str1.slen = len; 375 375 376 len = hdr2->vptr->print_on(hdr2, str2.ptr, BUFLEN);377 if (len < 1) {376 len = pjsip_hdr_print_on(hdr2, str2.ptr, BUFLEN); 377 if (len < 0) { 378 378 status = -50; 379 379 goto on_return; 380 380 } … … 1937 1937 /* Print the parsed header*/ 1938 1938 output = (char*) pj_pool_alloc(pool, 1024); 1939 1939 len = pjsip_hdr_print_on(parsed_hdr1, output, 1024); 1940 if (len < 1|| len >= 1024) {1940 if (len < 0 || len >= 1024) { 1941 1941 PJ_LOG(3,(THIS_FILE, " header too long: %s: %s", test->hname, test->hcontent)); 1942 1942 return -530; 1943 1943 } -
pjsip/src/pjsip/sip_msg.c
456 456 457 457 /* Print each of the headers. */ 458 458 for (hdr=msg->hdr.next; hdr!=&msg->hdr; hdr=hdr->next) { 459 len = (*hdr->vptr->print_on)(hdr, p, end-p);460 if (len < 1)459 len = pjsip_hdr_print_on(hdr, p, end-p); 460 if (len < 0) 461 461 return -1; 462 p += len;463 462 464 if (p+3 >= end) 465 return -1; 463 if (len > 0) { 464 p += len; 465 if (p+3 >= end) 466 return -1; 466 467 467 *p++ = '\r'; 468 *p++ = '\n'; 468 *p++ = '\r'; 469 *p++ = '\n'; 470 } 469 471 } 470 472 471 473 /* Process message body. */ … … 1601 1603 char *startbuf = buf; 1602 1604 char *endbuf = buf + size; 1603 1605 const pjsip_parser_const_t *pc = pjsip_parser_const(); 1606 char *p; 1607 1604 1608 /* Route and Record-Route don't compact forms */ 1605 1609 1606 1610 copy_advance(buf, hdr->name); 1607 1611 *buf++ = ':'; 1608 1612 *buf++ = ' '; 1609 1613 1614 p = buf; 1610 1615 printed = pjsip_uri_print(PJSIP_URI_IN_ROUTING_HDR, &hdr->name_addr, buf, 1611 1616 endbuf-buf); 1612 1617 if (printed < 1) 1613 1618 return -1; 1614 1619 buf += printed; 1615 1620 1621 /* Ticket #832: 1622 * Check the proprietary param 'hide', don't print this header 1623 * if it exists in the route URI. 1624 */ 1625 while(1) { 1626 const pj_str_t st_hide = {"hide", 4}; 1627 pj_str_t uri_param; 1628 char *p2; 1629 1630 /* Looking for ';' separator. */ 1631 while (p < buf && *p != ';') { ++p; } 1632 if (p >= buf) 1633 break; 1634 1635 /* Looking for another ';' separator or end-of-URI. */ 1636 p2 = ++p; 1637 while (p2 < buf && *p2 != ';' && *p2 != '>') { ++p2; } 1638 1639 pj_strset(&uri_param, p, p2-p); 1640 if (pj_stricmp(&uri_param, &st_hide) == 0) { 1641 return 0; 1642 } 1643 } 1644 1645 1616 1646 printed = pjsip_param_print_on(&hdr->other_param, buf, endbuf-buf, 1617 1647 &pc->pjsip_TOKEN_SPEC, 1618 1648 &pc->pjsip_TOKEN_SPEC, ';'); -
pjsip/src/pjsip/sip_ua_layer.c
907 907 char userinfo[128]; 908 908 909 909 len = pjsip_hdr_print_on(dlg->remote.info, userinfo, sizeof(userinfo)); 910 if (len < 1)910 if (len < 0) 911 911 pj_ansi_strcpy(userinfo, "<--uri too long-->"); 912 912 else 913 913 userinfo[len] = '\0'; -
pjsip/src/pjsua-lib/pjsua_call.c
2694 2694 /* Dump invite sesion info. */ 2695 2695 2696 2696 len = pjsip_hdr_print_on(dlg->remote.info, userinfo, sizeof(userinfo)); 2697 if (len < 1)2697 if (len < 0) 2698 2698 pj_ansi_strcpy(userinfo, "<--uri too long-->"); 2699 2699 else 2700 2700 userinfo[len] = '\0'; -
pjsip-apps/src/samples/siprtp_report.c
77 77 78 78 /* Call identification */ 79 79 len = pjsip_hdr_print_on(dlg->remote.info, userinfo, sizeof(userinfo)); 80 if (len < 1)80 if (len < 0) 81 81 pj_ansi_strcpy(userinfo, "<--uri too long-->"); 82 82 else 83 83 userinfo[len] = '\0';