dect
/
asterisk
Archived
13
0
Fork 0
This repository has been archived on 2022-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
asterisk/include
mmichelson b6c8764285 Fix two problems in ast_str functions found while writing a unit test.
1. The documentation for ast_str_set and ast_str_append state that
the max_len parameter may be -1 in order to limit the size of the
ast_str to its current allocated size. The problem was that the max_len
parameter in all cases was a size_t, which is unsigned. Thus a -1 was
interpreted as UINT_MAX instead of -1. Changing the max_len parameter
to be ssize_t fixed this issue.

2. Once issue 1 was fixed, there was an off-by-one error in the case
where we attempted to write a string larger than the current allotted
size to a string when -1 was passed as the max_len parameter. When trying
to write more than the allotted size, the ast_str's __AST_STR_USED was
set to 1 higher than it should have been. Thanks to Tilghman for quickly
spotting the offending line of code.

Oh, and the unit test that I referenced in the top line of this commit
will be added to reviewboard shortly. Sit tight...



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@247335 f38db490-d61c-443f-a65b-d21fe96a405b
2010-02-17 21:22:40 +00:00
..
asterisk Fix two problems in ast_str functions found while writing a unit test. 2010-02-17 21:22:40 +00:00
solaris-compat fix the provided unsetenv for solaris to return an int like it's supposed to 2006-03-29 04:14:12 +00:00
asterisk.h Revert attempt to standardize with _POSIX_C_SOURCE. 2009-09-03 03:30:42 +00:00
jitterbuf.h incorporates r159808 from branches/1.4: 2008-11-29 17:57:39 +00:00