- Timestamp:
- Nov 8, 2017 2:58:18 AM (7 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 2 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/build/pjlib.vcproj
r4537 r5682 14971 14971 </File> 14972 14972 <File 14973 RelativePath="..\include\pj\limits.h" 14974 > 14975 </File> 14976 <File 14973 14977 RelativePath="..\include\pj\list.h" 14974 14978 > … … 15074 15078 </File> 15075 15079 <File 15080 RelativePath="..\include\pj\compat\limits.h" 15081 > 15082 </File> 15083 <File 15076 15084 RelativePath="..\include\pj\compat\m_alpha.h" 15077 15085 > -
pjproject/trunk/pjlib/build/pjlib.vcxproj
r5539 r5682 495 495 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> 496 496 </ClCompile> 497 <ClCompile Include="..\src\pj\file_io_win32.c" /> 497 <ClCompile Include="..\src\pj\file_io_win32.c" /> 498 498 <ClCompile Include="..\src\pj\guid.c" /> 499 499 <ClCompile Include="..\src\pj\guid_simple.c"> … … 891 891 <ClInclude Include="..\include\pj\compat\errno.h" /> 892 892 <ClInclude Include="..\include\pj\compat\high_precision.h" /> 893 <ClInclude Include="..\include\pj\compat\limits.h" /> 893 894 <ClInclude Include="..\include\pj\compat\malloc.h" /> 894 895 <ClInclude Include="..\include\pj\compat\m_alpha.h" /> … … 926 927 <ClInclude Include="..\include\pj\ioqueue.h" /> 927 928 <ClInclude Include="..\include\pj\ip_helper.h" /> 929 <ClInclude Include="..\include\pj\limits.h" /> 928 930 <ClInclude Include="..\include\pj\list.h" /> 929 931 <ClInclude Include="..\include\pj\list_i.h" /> -
pjproject/trunk/pjlib/build/pjlib.vcxproj.filters
r5539 r5682 440 440 <Filter>Header Files\compat</Filter> 441 441 </ClInclude> 442 <ClInclude Include="..\include\pj\limits.h"> 443 <Filter>Header Files</Filter> 444 </ClInclude> 445 <ClInclude Include="..\include\pj\compat\limits.h"> 446 <Filter>Header Files\compat</Filter> 447 </ClInclude> 442 448 </ItemGroup> 443 449 </Project> -
pjproject/trunk/pjlib/include/pj/compat/os_win32.h
r3553 r5682 58 58 #define PJ_HAS_TIME_H 1 59 59 #define PJ_HAS_UNISTD_H 0 60 #define PJ_HAS_LIMITS_H 1 60 61 61 62 #define PJ_HAS_MSWSOCK_H 1 -
pjproject/trunk/pjlib/include/pj/string.h
r5520 r5682 28 28 #include <pj/types.h> 29 29 #include <pj/compat/string.h> 30 31 30 32 31 PJ_BEGIN_DECL … … 637 636 638 637 /** 638 * Convert string to signed long integer. The conversion will stop as 639 * soon as non-digit character is found or all the characters have 640 * been processed. 641 * 642 * @param str the string. 643 * @param value Pointer to a long to receive the value. 644 * 645 * @return PJ_SUCCESS if successful. Otherwise: 646 * PJ_ETOOSMALL if the value was an impossibly long negative number. 647 * In this case *value will be set to LONG_MIN. 648 * \n 649 * PJ_ETOOBIG if the value was an impossibly long positive number. 650 * In this case, *value will be set to LONG_MAX. 651 * \n 652 * PJ_EINVAL if the input string was NULL, the value pointer was NULL 653 * or the input string could not be parsed at all such as starting with 654 * a character other than a '+', '-' or not in the '0' - '9' range. 655 * In this case, *value will be left untouched. 656 */ 657 PJ_DECL(pj_status_t) pj_strtol2(const pj_str_t *str, long *value); 658 659 660 /** 639 661 * Convert string to unsigned integer. The conversion will stop as 640 662 * soon as non-digit character is found or all the characters have … … 663 685 PJ_DECL(unsigned long) pj_strtoul2(const pj_str_t *str, pj_str_t *endptr, 664 686 unsigned base); 687 688 /** 689 * Convert string to unsigned long integer. The conversion will stop as 690 * soon as non-digit character is found or all the characters have 691 * been processed. 692 * 693 * @param str The input string. 694 * @param value Pointer to an unsigned long to receive the value. 695 * @param base Number base to use. 696 * 697 * @return PJ_SUCCESS if successful. Otherwise: 698 * PJ_ETOOBIG if the value was an impossibly long positive number. 699 * In this case, *value will be set to ULONG_MAX. 700 * \n 701 * PJ_EINVAL if the input string was NULL, the value pointer was NULL 702 * or the input string could not be parsed at all such as starting 703 * with a character outside the base character range. In this case, 704 * *value will be left untouched. 705 */ 706 PJ_DECL(pj_status_t) pj_strtoul3(const pj_str_t *str, unsigned long *value, 707 unsigned base); 665 708 666 709 /** … … 787 830 } 788 831 789 790 832 /** 791 833 * @} -
pjproject/trunk/pjlib/include/pj/types.h
r4704 r5682 280 280 /** Utility macro to compute the number of elements in static array. */ 281 281 #define PJ_ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0])) 282 283 /** Maximum value for signed 32-bit integer. */284 #define PJ_MAXINT32 0x7FFFFFFFL285 282 286 283 /** -
pjproject/trunk/pjlib/src/pj/string.c
r5520 r5682 24 24 #include <pj/rand.h> 25 25 #include <pj/os.h> 26 #include <pj/errno.h> 27 #include <pj/limits.h> 26 28 27 29 #if PJ_FUNCTIONS_ARE_INLINED==0 28 30 # include <pj/string_i.h> 29 31 #endif 32 30 33 31 34 PJ_DEF(pj_ssize_t) pj_strspn(const pj_str_t *str, const pj_str_t *set_char) … … 231 234 } 232 235 236 237 PJ_DEF(pj_status_t) pj_strtol2(const pj_str_t *str, long *value) 238 { 239 pj_str_t s; 240 unsigned long retval = 0; 241 pj_bool_t is_negative = PJ_FALSE; 242 int rc = 0; 243 244 PJ_CHECK_STACK(); 245 246 if (!str || !value) { 247 return PJ_EINVAL; 248 } 249 250 s = *str; 251 pj_strltrim(&s); 252 253 if (s.slen == 0) 254 return PJ_EINVAL; 255 256 if (s.ptr[0] == '+' || s.ptr[0] == '-') { 257 is_negative = (s.ptr[0] == '-'); 258 s.ptr += 1; 259 s.slen -= 1; 260 } 261 262 rc = pj_strtoul3(&s, &retval, 10); 263 if (rc == PJ_EINVAL) { 264 return rc; 265 } else if (rc != PJ_SUCCESS) { 266 *value = is_negative ? PJ_MINLONG : PJ_MAXLONG; 267 return is_negative ? PJ_ETOOSMALL : PJ_ETOOBIG; 268 } 269 270 if (retval > PJ_MAXLONG && !is_negative) { 271 *value = PJ_MAXLONG; 272 return PJ_ETOOBIG; 273 } 274 275 if (retval > (PJ_MAXLONG + 1UL) && is_negative) { 276 *value = PJ_MINLONG; 277 return PJ_ETOOSMALL; 278 } 279 280 *value = is_negative ? -(long)retval : retval; 281 282 return PJ_SUCCESS; 283 } 284 233 285 PJ_DEF(unsigned long) pj_strtoul(const pj_str_t *str) 234 286 { … … 281 333 282 334 return value; 335 } 336 337 PJ_DEF(pj_status_t) pj_strtoul3(const pj_str_t *str, unsigned long *value, 338 unsigned base) 339 { 340 pj_str_t s; 341 unsigned i; 342 343 PJ_CHECK_STACK(); 344 345 if (!str || !value) { 346 return PJ_EINVAL; 347 } 348 349 s = *str; 350 pj_strltrim(&s); 351 352 if (s.slen == 0 || s.ptr[0] < '0' || 353 (base <= 10 && (unsigned)s.ptr[0] > ('0' - 1) + base) || 354 (base == 16 && !pj_isxdigit(s.ptr[0]))) 355 { 356 return PJ_EINVAL; 357 } 358 359 *value = 0; 360 if (base <= 10) { 361 for (i=0; i<(unsigned)s.slen; ++i) { 362 unsigned c = s.ptr[i] - '0'; 363 if (s.ptr[i] < '0' || (unsigned)s.ptr[i] > ('0' - 1) + base) { 364 break; 365 } 366 if (*value > PJ_MAXULONG / base) { 367 *value = PJ_MAXULONG; 368 return PJ_ETOOBIG; 369 } 370 371 *value *= base; 372 if ((PJ_MAXULONG - *value) < c) { 373 *value = PJ_MAXULONG; 374 return PJ_ETOOBIG; 375 } 376 *value += c; 377 } 378 } else if (base == 16) { 379 for (i=0; i<(unsigned)s.slen; ++i) { 380 unsigned c = pj_hex_digit_to_val(s.ptr[i]); 381 if (!pj_isxdigit(s.ptr[i])) 382 break; 383 384 if (*value > PJ_MAXULONG / base) { 385 *value = PJ_MAXULONG; 386 return PJ_ETOOBIG; 387 } 388 *value *= base; 389 if ((PJ_MAXULONG - *value) < c) { 390 *value = PJ_MAXULONG; 391 return PJ_ETOOBIG; 392 } 393 *value += c; 394 } 395 } else { 396 pj_assert(!"Unsupported base"); 397 return PJ_EINVAL; 398 } 399 return PJ_SUCCESS; 283 400 } 284 401 … … 357 474 return len; 358 475 } 359 360 -
pjproject/trunk/pjlib/src/pj/timer.c
r4855 r5682 37 37 #include <pj/log.h> 38 38 #include <pj/rand.h> 39 #include <pj/limits.h> 39 40 40 41 #define THIS_FILE "timer.c" -
pjproject/trunk/pjsip/include/pjsip/sip_parser.h
r4445 r5682 38 38 * @{ 39 39 */ 40 41 /** 42 * Contants for limit checks 43 */ 44 #define PJSIP_MIN_CONTENT_LENGTH 0 45 #define PJSIP_MAX_CONTENT_LENGTH PJ_MAXINT32 46 #define PJSIP_MIN_PORT 0 47 #define PJSIP_MAX_PORT PJ_MAXUINT16 48 #define PJSIP_MIN_TTL 0 49 #define PJSIP_MAX_TTL PJ_MAXUINT8 50 #define PJSIP_MIN_STATUS_CODE 100 51 #define PJSIP_MAX_STATUS_CODE 999 52 #define PJSIP_MIN_Q1000 0 53 #define PJSIP_MAX_Q1000 PJ_MAXINT32 / 1000 54 #define PJSIP_MIN_EXPIRES 0 55 #define PJSIP_MAX_EXPIRES PJ_MAXINT32 56 #define PJSIP_MIN_CSEQ 0 57 #define PJSIP_MAX_CSEQ PJ_MAXINT32 58 #define PJSIP_MIN_RETRY_AFTER 0 59 #define PJSIP_MAX_RETRY_AFTER PJ_MAXINT32 40 60 41 61 /** … … 63 83 */ 64 84 extern int PJSIP_SYN_ERR_EXCEPTION; 85 86 /** 87 * Invalid value error exception value. 88 */ 89 extern int PJSIP_EINVAL_ERR_EXCEPTION; 65 90 66 91 /** -
pjproject/trunk/pjsip/src/pjsip/sip_parser.c
r5280 r5682 35 35 #include <pj/ctype.h> 36 36 #include <pj/assert.h> 37 #include <pj/limits.h> 37 38 38 39 #define THIS_FILE "sip_parser.c" … … 94 95 */ 95 96 int PJSIP_SYN_ERR_EXCEPTION = -1; 97 int PJSIP_EINVAL_ERR_EXCEPTION = -2; 96 98 97 99 /* Parser constants */ … … 206 208 #define parser_stricmp(s1, s2) (s1.slen!=s2.slen || pj_stricmp_alnum(&s1, &s2)) 207 209 208 209 210 /* Get a token and unescape */ 210 211 PJ_INLINE(void) parser_get_and_unescape(pj_scanner *scanner, pj_pool_t *pool, … … 224 225 } 225 226 226 227 228 227 /* Syntax error handler for parser. */ 229 228 static void on_syntax_error(pj_scanner *scanner) … … 231 230 PJ_UNUSED_ARG(scanner); 232 231 PJ_THROW(PJSIP_SYN_ERR_EXCEPTION); 232 } 233 234 /* Syntax error handler for parser. */ 235 static void on_str_parse_error(const pj_str_t *str, int rc) 236 { 237 char *s; 238 239 switch(rc) { 240 case PJ_EINVAL: 241 s = "NULL input string, invalid input string, or NULL return "\ 242 "value pointer"; 243 break; 244 case PJ_ETOOSMALL: 245 s = "String value was less than the minimum allowed value."; 246 break; 247 case PJ_ETOOBIG: 248 s = "String value was greater than the maximum allowed value."; 249 break; 250 default: 251 s = "Unknown error"; 252 } 253 254 if (str) { 255 PJ_LOG(1, (THIS_FILE, "Error parsing '%.*s': %s", 256 (int)str->slen, str->ptr, s)); 257 } else { 258 PJ_LOG(1, (THIS_FILE, "Can't parse input string: %s", s)); 259 } 260 PJ_THROW(PJSIP_EINVAL_ERR_EXCEPTION); 261 } 262 263 static void strtoi_validate(const pj_str_t *str, int min_val, 264 int max_val, int *value) 265 { 266 long retval; 267 pj_status_t status; 268 269 if (!str || !value) { 270 on_str_parse_error(str, PJ_EINVAL); 271 } 272 status = pj_strtol2(str, &retval); 273 if (status != PJ_EINVAL) { 274 if (min_val > retval) { 275 *value = min_val; 276 status = PJ_ETOOSMALL; 277 } else if (retval > max_val) { 278 *value = max_val; 279 status = PJ_ETOOBIG; 280 } else 281 *value = (int)retval; 282 } 283 284 if (status != PJ_SUCCESS) 285 on_str_parse_error(str, status); 233 286 } 234 287 … … 286 339 287 340 /* 341 * Invalid value exception. 342 */ 343 pj_assert (PJSIP_EINVAL_ERR_EXCEPTION == -2); 344 status = pj_exception_id_alloc("PJSIP invalid value error", 345 &PJSIP_EINVAL_ERR_EXCEPTION); 346 PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); 347 348 /* 288 349 * Init character input spec (cis) 289 350 */ … … 503 564 pj_exception_id_free(PJSIP_SYN_ERR_EXCEPTION); 504 565 PJSIP_SYN_ERR_EXCEPTION = -1; 566 567 pj_exception_id_free(PJSIP_EINVAL_ERR_EXCEPTION); 568 PJSIP_EINVAL_ERR_EXCEPTION = -2; 505 569 } 506 570 pj_leave_critical_section(); … … 767 831 768 832 /* Determine if a message has been received. */ 769 PJ_DEF(pj_ bool_t) pjsip_find_msg( const char *buf, pj_size_t size,833 PJ_DEF(pj_status_t) pjsip_find_msg( const char *buf, pj_size_t size, 770 834 pj_bool_t is_datagram, pj_size_t *msg_size) 771 835 { … … 777 841 int content_length = -1; 778 842 pj_str_t cur_msg; 843 pj_status_t status = PJ_SUCCESS; 779 844 const pj_str_t end_hdr = { "\n\r\n", 3}; 780 845 … … 837 902 838 903 /* Found a valid Content-Length header. */ 839 content_length = pj_strtoul(&str_clen); 904 strtoi_validate(&str_clen, PJSIP_MIN_CONTENT_LENGTH, 905 PJSIP_MAX_CONTENT_LENGTH, &content_length); 840 906 } 841 907 PJ_CATCH_ANY { 908 int eid = PJ_GET_EXCEPTION(); 909 if (eid == PJSIP_SYN_ERR_EXCEPTION) { 910 status = PJSIP_EMISSINGHDR; 911 } else if (eid == PJSIP_EINVAL_ERR_EXCEPTION) { 912 status = PJSIP_EINVALIDHDR; 913 } 842 914 content_length = -1; 843 915 } … … 859 931 /* Found Content-Length? */ 860 932 if (content_length == -1) { 861 return PJSIP_EMISSINGHDR;933 return status; 862 934 } 863 935 … … 939 1011 pjsip_parser_err_report *err_list) 940 1012 { 941 pj_bool_t parsing_headers; 942 pjsip_msg *msg = NULL; 1013 /* These variables require "volatile" so their values get 1014 * preserved when re-entering the PJ_TRY block after an error. 1015 */ 1016 volatile pj_bool_t parsing_headers; 1017 pjsip_msg *volatile msg = NULL; 1018 pjsip_ctype_hdr *volatile ctype_hdr = NULL; 1019 943 1020 pj_str_t hname; 944 pjsip_ctype_hdr *ctype_hdr = NULL;945 1021 pj_scanner *scanner = ctx->scanner; 946 1022 pj_pool_t *pool = ctx->pool; … … 1024 1100 } 1025 1101 1026 1027 1102 /* Single parse of header line can produce multiple headers. 1028 1103 * For example, if one Contact: header contains Contact list … … 1268 1343 pj_scan_get_char(scanner); 1269 1344 pj_scan_get(scanner, &pconst.pjsip_DIGIT_SPEC, &port); 1270 *p_port = pj_strtoul(&port);1345 strtoi_validate(&port, PJSIP_MIN_PORT, PJSIP_MAX_PORT, p_port); 1271 1346 } else { 1272 1347 *p_port = 0; … … 1459 1534 1460 1535 } else if (!parser_stricmp(pname, pconst.pjsip_TTL_STR) && pvalue.slen) { 1461 url->ttl_param = pj_strtoul(&pvalue);1462 1536 strtoi_validate(&pvalue, PJSIP_MIN_TTL, PJSIP_MAX_TTL, 1537 &url->ttl_param); 1463 1538 } else if (!parser_stricmp(pname, pconst.pjsip_MADDR_STR) && pvalue.slen) { 1464 1539 url->maddr_param = pvalue; … … 1596 1671 parse_sip_version(scanner); 1597 1672 pj_scan_get( scanner, &pconst.pjsip_DIGIT_SPEC, &token); 1598 status_line->code = pj_strtoul(&token); 1673 strtoi_validate(&token, PJSIP_MIN_STATUS_CODE, PJSIP_MAX_STATUS_CODE, 1674 &status_line->code); 1599 1675 if (*scanner->curptr != '\r' && *scanner->curptr != '\n') 1600 1676 pj_scan_get( scanner, &pconst.pjsip_NOT_NEWLINE, &status_line->reason); … … 1781 1857 char *dot_pos = (char*) pj_memchr(pvalue.ptr, '.', pvalue.slen); 1782 1858 if (!dot_pos) { 1783 hdr->q1000 = pj_strtoul(&pvalue) * 1000; 1859 strtoi_validate(&pvalue, PJSIP_MIN_Q1000, PJSIP_MAX_Q1000, 1860 &hdr->q1000); 1861 hdr->q1000 *= 1000; 1784 1862 } else { 1785 1863 pj_str_t tmp = pvalue; 1864 unsigned long qval_frac; 1786 1865 1787 1866 tmp.slen = dot_pos - pvalue.ptr; 1788 hdr->q1000 = pj_strtoul(&tmp) * 1000; 1867 strtoi_validate(&tmp, PJSIP_MIN_Q1000, PJSIP_MAX_Q1000, 1868 &hdr->q1000); 1869 hdr->q1000 *= 1000; 1789 1870 1790 1871 pvalue.slen = (pvalue.ptr+pvalue.slen) - (dot_pos+1); 1791 1872 pvalue.ptr = dot_pos + 1; 1792 hdr->q1000 += pj_strtoul_mindigit(&pvalue, 3); 1873 if (pvalue.slen > 3) { 1874 pvalue.slen = 3; 1875 } 1876 qval_frac = pj_strtoul_mindigit(&pvalue, 3); 1877 if ((unsigned)hdr->q1000 > (PJ_MAXINT32 - qval_frac)) { 1878 PJ_THROW(PJSIP_SYN_ERR_EXCEPTION); 1879 } 1880 hdr->q1000 += qval_frac; 1793 1881 } 1794 } else if (!parser_stricmp(pname, pconst.pjsip_EXPIRES_STR) && pvalue.slen) { 1795 hdr->expires = pj_strtoul(&pvalue); 1796 1882 } else if (!parser_stricmp(pname, pconst.pjsip_EXPIRES_STR) && 1883 pvalue.slen) 1884 { 1885 strtoi_validate(&pvalue, PJSIP_MIN_EXPIRES, PJSIP_MAX_EXPIRES, 1886 &hdr->expires); 1797 1887 } else { 1798 1888 pjsip_param *p = PJ_POOL_ALLOC_T(pool, pjsip_param); … … 1891 1981 { 1892 1982 pj_str_t cseq, method; 1893 pjsip_cseq_hdr *hdr; 1983 pjsip_cseq_hdr *hdr = NULL; 1984 int cseq_val = 0; 1985 1986 pj_scan_get( ctx->scanner, &pconst.pjsip_DIGIT_SPEC, &cseq); 1987 strtoi_validate(&cseq, PJSIP_MIN_CSEQ, PJSIP_MAX_CSEQ, &cseq_val); 1894 1988 1895 1989 hdr = pjsip_cseq_hdr_create(ctx->pool); 1896 pj_scan_get( ctx->scanner, &pconst.pjsip_DIGIT_SPEC, &cseq); 1897 hdr->cseq = pj_strtoul(&cseq); 1990 hdr->cseq = cseq_val; 1898 1991 1899 1992 pj_scan_get( ctx->scanner, &pconst.pjsip_TOKEN_SPEC, &method); 1993 parse_hdr_end( ctx->scanner ); 1994 1900 1995 pjsip_method_init_np(&hdr->method, &method); 1901 1902 parse_hdr_end( ctx->scanner ); 1903 1904 if (ctx->rdata) 1996 if (ctx->rdata) { 1905 1997 ctx->rdata->msg_info.cseq = hdr; 1998 } 1906 1999 1907 2000 return (pjsip_hdr*)hdr; … … 1985 2078 1986 2079 pj_scan_get(scanner, &pconst.pjsip_DIGIT_SPEC, &tmp); 1987 hdr->ivalue = pj_strtoul(&tmp); 2080 strtoi_validate(&tmp, PJSIP_MIN_RETRY_AFTER, PJSIP_MAX_RETRY_AFTER, 2081 &hdr->ivalue); 1988 2082 1989 2083 while (!pj_scan_is_eof(scanner) && *scanner->curptr!='\r' && … … 2074 2168 2075 2169 } else if (!parser_stricmp(pname, pconst.pjsip_TTL_STR) && pvalue.slen) { 2076 hdr->ttl_param = pj_strtoul(&pvalue); 2170 strtoi_validate(&pvalue, PJSIP_MIN_TTL, PJSIP_MAX_TTL, 2171 &hdr->ttl_param); 2077 2172 2078 2173 } else if (!parser_stricmp(pname, pconst.pjsip_MADDR_STR) && pvalue.slen) { … … 2083 2178 2084 2179 } else if (!parser_stricmp(pname, pconst.pjsip_RPORT_STR)) { 2085 if (pvalue.slen) 2086 hdr->rport_param = pj_strtoul(&pvalue); 2087 else 2180 if (pvalue.slen) { 2181 strtoi_validate(&pvalue, PJSIP_MIN_PORT, PJSIP_MAX_PORT, 2182 &hdr->rport_param); 2183 } else 2088 2184 hdr->rport_param = 0; 2089 2185 } else { … … 2214 2310 pj_scan_get_char(scanner); 2215 2311 pj_scan_get(scanner, &pconst.pjsip_DIGIT_SPEC, &digit); 2216 hdr->sent_by.port = pj_strtoul(&digit); 2312 strtoi_validate(&digit, PJSIP_MIN_PORT, PJSIP_MAX_PORT, 2313 &hdr->sent_by.port); 2217 2314 } 2218 2315 … … 2299 2396 { 2300 2397 enum { STOP_ON_ERROR = 1 }; 2398 pj_str_t hname; 2301 2399 pj_scanner scanner; 2302 2400 pjsip_parse_ctx ctx; 2303 pj_str_t hname; 2401 2304 2402 PJ_USE_EXCEPTION; 2305 2403 … … 2324 2422 hname.slen = 0; 2325 2423 2326 /* Get hname. */ 2424 /* Get hname. */ 2327 2425 pj_scan_get( &scanner, &pconst.pjsip_TOKEN_SPEC, &hname); 2328 2426 if (pj_scan_get_char( &scanner ) != ':') { -
pjproject/trunk/pjsip/src/pjsip/sip_transaction.c
r5613 r5682 290 290 /* Calculate length required. */ 291 291 len_required = method->name.slen + /* Method */ 292 9+ /* CSeq number */292 11 + /* CSeq number */ 293 293 rdata->msg_info.from->tag.slen + /* From tag. */ 294 294 rdata->msg_info.cid->id.slen + /* Call-ID */ 295 295 host->slen + /* Via host. */ 296 9+ /* Via port. */296 11 + /* Via port. */ 297 297 16; /* Separator+Allowance. */ 298 298 key = p = (char*) pj_pool_alloc(pool, len_required); -
pjproject/trunk/pjsip/src/pjsip/sip_transport.c
r5564 r5682 1849 1849 if (msg==NULL || !pj_list_empty(&rdata->msg_info.parse_err)) { 1850 1850 pjsip_parser_err_report *err; 1851 char buf[ 128];1851 char buf[256]; 1852 1852 pj_str_t tmp; 1853 1853 … … 1863 1863 (int)err->hname.slen, err->hname.ptr, 1864 1864 err->line, err->col); 1865 if (len > 0 && len < (int) (sizeof(buf)-tmp.slen)) { 1865 if (len >= (int)sizeof(buf)-tmp.slen) { 1866 len = (int)sizeof(buf)-tmp.slen; 1867 } 1868 if (len > 0) { 1866 1869 tmp.slen += len; 1867 1870 }
Note: See TracChangeset
for help on using the changeset viewer.