summaryrefslogtreecommitdiff
path: root/main/strings.c
AgeCommit message (Collapse)Author
2010-05-18fixes segfault on logging David Vossel
(closes issue #17331) Reported by: under Patches: utils.diff uploaded by under (license 914) segfault_on_logging.diff uploaded by dvossel (license 671) Tested by: under, dvossel git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@263904 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-17Fix two problems in ast_str functions found while writing a unit test.Mark Michelson
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: https://origsvn.digium.com/svn/asterisk/trunk@247335 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-16Add va_end calls to __ast_str_helper.Mark Michelson
According to the man page for stdarg(3), "Each invocation of va_copy() must be matched by a corresponding invocation of va_end() in the same function." There were several cases in __ast_str_helper where va_copy was not matched with a corresponding call to va_end. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@247076 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-16Change the blanket rules to delete .lastclean on all CFLAGS menuselect ↵Tilghman Lesher
targets to be more particular. This change builds upon the recent change to menuselect to add 'touch_on_change' as an attribute of both categories and members. This should allow only the most invasive defines to cause a complete rebuild, while defines which only affect a subset of modules will only cause a rebuild of that smaller set. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@246789 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-29Merge str_substitution branch.Tilghman Lesher
This branch adds additional methods to dialplan functions, whereby the result buffers are now dynamic buffers, which can be expanded to the size of any result. No longer are variable substitutions limited to 4095 bytes of data. In addition, the common case of needing buffers much smaller than that will enable substitution to only take up the amount of memory actually needed. The existing variable substitution routines are still available, but users of those API calls should transition to using the dynamic-buffer APIs. Reviewboard: http://reviewboard.digium.com/r/174/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@191140 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-02Missed a common case for needing to extend the buffer.Tilghman Lesher
(closes issue #14716) Reported by: sum Patches: 20090402__bug14716.diff.txt uploaded by tilghman (license 14) Tested by: sum git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@186021 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-01Merge changes from str_substitution that are unrelated to that branch.Tilghman Lesher
Included is a small bugfix to an ast_str helper, but most of these changes are simply doxygen fixes. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@185912 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-11Add MALLOC_DEBUG to various utility APIs, so that memory leaks can be ↵Tilghman Lesher
tracked back to their source. (related to issue #14636) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@181028 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-18Handle negative length and eliminate a condition that is always true.Tilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@177287 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-16Might want to update the buffer pointer after a realloc (or we crash)Tilghman Lesher
(closes issue #14485) Reported by: davevg git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@176360 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-18Remove duplicate code from the ast_str API. We now use __AST_STR_* toEliel C. Sardanons
access 'struct ast_str' members, but this must only be used inside the API implementation. (closes issue #14098) Reported by: eliel Patches: ast_str.patch uploaded by eliel (license 64) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@165502 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-13Merge ast_str_opaque branch (discontinue usage of ast_str internals)Tilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@163991 65c4cc65-6c06-0410-ace0-fbb531ad65f3