Mark Michelson
2ce7eabb24
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: https://origsvn.digium.com/svn/asterisk/trunk@247335 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-17 21:22:40 +00:00
..
2010-01-15 23:09:09 +00:00
2009-12-22 16:09:11 +00:00
2009-11-04 14:05:12 +00:00
2009-09-03 16:31:54 +00:00
2007-12-11 14:17:29 +00:00
2008-08-08 00:48:35 +00:00
2007-05-24 22:07:50 +00:00
2009-09-26 15:10:28 +00:00
2009-06-15 16:07:23 +00:00
2007-12-11 14:17:29 +00:00
2009-12-21 18:51:17 +00:00
2009-04-29 18:53:01 +00:00
2008-02-26 20:02:14 +00:00
2007-12-11 14:17:29 +00:00
2010-01-12 07:48:16 +00:00
2010-02-05 21:21:05 +00:00
2008-07-11 14:22:44 +00:00
2006-11-15 20:55:17 +00:00
2010-01-08 19:39:30 +00:00
2009-04-24 14:04:26 +00:00
2010-02-10 16:01:28 +00:00
2009-03-05 18:18:27 +00:00
2009-11-04 14:05:12 +00:00
2009-11-04 14:05:12 +00:00
2008-10-30 16:53:11 +00:00
2009-10-13 01:51:46 +00:00
2009-12-21 18:51:17 +00:00
2009-01-29 17:08:22 +00:00
2009-12-18 22:51:37 +00:00
2009-12-21 18:51:17 +00:00
2010-01-04 18:28:28 +00:00
2008-10-14 22:38:06 +00:00
2009-05-23 13:31:56 +00:00
2009-12-06 07:01:06 +00:00
2009-06-15 16:07:23 +00:00
2009-03-09 20:58:17 +00:00
2009-04-03 15:52:50 +00:00
2009-05-05 10:34:19 +00:00
2009-07-08 22:15:06 +00:00
2008-10-31 20:05:46 +00:00
2009-03-09 20:58:17 +00:00
2006-08-21 02:11:39 +00:00
2009-03-09 20:58:17 +00:00
2009-12-21 18:51:17 +00:00
2009-10-21 03:09:04 +00:00
2008-11-29 17:57:39 +00:00
2008-10-09 17:48:53 +00:00
2009-03-09 20:58:17 +00:00
2009-07-11 19:15:03 +00:00
2010-02-10 23:19:16 +00:00
2009-05-21 21:13:09 +00:00
2009-09-24 20:29:51 +00:00
2009-11-30 21:31:55 +00:00
2009-11-04 14:05:12 +00:00
2009-11-04 14:05:12 +00:00
2008-07-21 20:59:03 +00:00
2008-07-21 20:59:03 +00:00
2008-07-21 21:00:47 +00:00
2009-01-30 21:29:12 +00:00
2009-03-11 00:29:59 +00:00
2009-03-27 01:35:56 +00:00
2009-12-21 18:51:17 +00:00
2009-05-21 21:13:09 +00:00
2009-02-21 13:17:47 +00:00
2005-11-29 18:24:39 +00:00
2009-03-18 02:28:55 +00:00
2009-12-16 20:25:27 +00:00
2008-05-28 14:10:48 +00:00
2009-10-28 18:04:05 +00:00
2008-10-01 23:02:25 +00:00
2009-11-09 14:37:07 +00:00
2009-12-21 18:51:17 +00:00
2010-02-04 18:47:21 +00:00
2007-11-16 20:04:58 +00:00
2009-12-01 17:48:54 +00:00
2009-07-27 16:33:50 +00:00
2009-06-15 16:07:23 +00:00
2007-07-16 02:51:56 +00:00
2009-10-08 19:35:30 +00:00
2008-06-12 17:38:27 +00:00
2009-06-15 16:07:23 +00:00
2010-01-27 18:29:49 +00:00
2007-12-20 09:55:05 +00:00
2010-01-25 21:13:20 +00:00
2009-11-02 22:29:19 +00:00
2007-11-16 20:04:58 +00:00
2009-03-18 02:28:55 +00:00
2005-11-29 18:24:39 +00:00
2008-12-09 17:18:03 +00:00
2009-04-01 20:13:28 +00:00
2009-12-21 18:51:17 +00:00
2009-01-29 19:34:09 +00:00
2009-08-28 18:41:23 +00:00
2009-07-11 19:15:03 +00:00
2009-12-21 18:51:17 +00:00
2007-11-16 20:04:58 +00:00
2009-11-04 14:05:12 +00:00
2009-11-04 14:05:12 +00:00
2009-06-15 16:07:23 +00:00
2009-05-21 21:13:09 +00:00
2010-01-19 00:28:49 +00:00
2009-12-21 18:51:17 +00:00
2010-02-17 21:22:40 +00:00
2009-04-02 17:20:52 +00:00
2009-12-21 18:51:17 +00:00
2009-05-21 21:13:09 +00:00
2009-10-22 19:55:51 +00:00
2007-11-06 19:10:26 +00:00
2008-11-10 13:53:23 +00:00
2010-02-09 23:32:14 +00:00
2009-12-28 15:22:54 +00:00
2010-01-18 22:31:25 +00:00
2009-03-27 19:10:32 +00:00
2007-12-11 22:20:22 +00:00
2009-11-04 14:05:12 +00:00
2010-02-02 22:27:23 +00:00
2007-12-11 22:20:22 +00:00
2009-11-20 21:47:39 +00:00
2010-02-09 23:32:14 +00:00
2008-11-13 13:08:34 +00:00
2009-05-22 17:52:35 +00:00