summaryrefslogtreecommitdiff
path: root/main/channel_internal_api.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2014-03-20 16:35:57 +0000
committerRichard Mudgett <rmudgett@digium.com>2014-03-20 16:35:57 +0000
commit1ba13718fc46527587e3dc87e776858c472bb2d2 (patch)
treeee6d210eb73de1a218310149733f99009456e402 /main/channel_internal_api.c
parent57239bfe37d61977ef6eec82eca0cb6631e1d4ef (diff)
assigned-uniqueids: Miscellaneous cleanup and fixes.
* Fix memory leak in ast_unreal_new_channels(). Made it generate the ;2 uniqueid on a stack variable instead of mallocing it. * Made send error response to ARI and AMI requests instead of just logging excessive uniqueid length and allowing truncation. action_originate() and ari_channels_handle_originate_with_id(). * Fixed minor truncating uniqueid hole when generating the ;2 uniqueid string length. Created public and internal lengths of uniqueid. The internal length can handle a max public uniqueid plus an appended ;2. * free() and ast_free() are NULL tolerant so they don't need a NULL test before calling. * Made use better struct initialization format instead of the position dependent initialization format. Also anything not explicitly initialized in the struct is initialized to zero by the compiler. * Made ast_channel_internal_set_fake_ids() use the safer ast_copy_string() instead of strncpy(). Review: https://reviewboard.asterisk.org/r/3371/ ........ Merged revisions 410949 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410950 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/channel_internal_api.c')
-rw-r--r--main/channel_internal_api.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/main/channel_internal_api.c b/main/channel_internal_api.c
index d444d7fba..9cc99f3d5 100644
--- a/main/channel_internal_api.c
+++ b/main/channel_internal_api.c
@@ -1485,8 +1485,8 @@ void ast_channel_internal_swap_uniqueid_and_linkedid(struct ast_channel *a, stru
void ast_channel_internal_set_fake_ids(struct ast_channel *chan, const char *uniqueid, const char *linkedid)
{
- strncpy(chan->uniqueid.unique_id, uniqueid, sizeof(chan->uniqueid.unique_id));
- strncpy(chan->linkedid.unique_id, linkedid, sizeof(chan->linkedid.unique_id));
+ ast_copy_string(chan->uniqueid.unique_id, uniqueid, sizeof(chan->uniqueid.unique_id));
+ ast_copy_string(chan->linkedid.unique_id, linkedid, sizeof(chan->linkedid.unique_id));
}
void ast_channel_internal_cleanup(struct ast_channel *chan)