[svn-commits] russell: trunk r82803 - in /trunk: ./ pbx/pbx_dundi.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Sep 18 11:34:05 CDT 2007
Author: russell
Date: Tue Sep 18 11:34:05 2007
New Revision: 82803
URL: http://svn.digium.com/view/asterisk?view=rev&rev=82803
Log:
Merged revisions 82802 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r82802 | russell | 2007-09-18 11:31:01 -0500 (Tue, 18 Sep 2007) | 4 lines
When copying the contents from the wildcard peer, do a deep copy instead of
shallow copy so that it doesn't crash when beging destroyed.
(closes issue #10546, patch by me)
........
Modified:
trunk/ (props changed)
trunk/pbx/pbx_dundi.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Modified: trunk/pbx/pbx_dundi.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx/pbx_dundi.c?view=diff&rev=82803&r1=82802&r2=82803
==============================================================================
--- trunk/pbx/pbx_dundi.c (original)
+++ trunk/pbx/pbx_dundi.c Tue Sep 18 11:34:05 2007
@@ -1525,6 +1525,36 @@
ast_aes_decrypt_key(dst, &peer->them_dcx);
ast_aes_encrypt_key(dst, &peer->them_ecx);
return 1;
+}
+
+static void deep_copy_peer(struct dundi_peer *peer_dst, const struct dundi_peer *peer_src)
+{
+ struct permission *cur, *perm;
+
+ memcpy(peer_dst, peer_src, sizeof(*peer_dst));
+
+ memset(&peer_dst->permit, 0, sizeof(peer_dst->permit));
+ memset(&peer_dst->include, 0, sizeof(peer_dst->permit));
+
+ AST_LIST_TRAVERSE(&peer_src->permit, cur, list) {
+ if (!(perm = ast_calloc(1, sizeof(*perm) + strlen(cur->name) + 1)))
+ continue;
+
+ perm->allow = cur->allow;
+ strcpy(perm->name, cur->name);
+
+ AST_LIST_INSERT_HEAD(&peer_dst->permit, perm, list);
+ }
+
+ AST_LIST_TRAVERSE(&peer_src->include, cur, list) {
+ if (!(perm = ast_calloc(1, sizeof(*perm) + strlen(cur->name) + 1)))
+ continue;
+
+ perm->allow = cur->allow;
+ strcpy(perm->name, cur->name);
+
+ AST_LIST_INSERT_HEAD(&peer_dst->include, perm, list);
+ }
}
static int handle_command_response(struct dundi_transaction *trans, struct dundi_hdr *hdr, int datalen, int encrypted)
@@ -1630,7 +1660,7 @@
/* copy any_peer into a new peer object */
peer = ast_calloc(1, sizeof(*peer));
if (peer) {
- memcpy(peer, any_peer, sizeof(*peer));
+ deep_copy_peer(peer, any_peer);
/* set EID to remote EID */
peer->eid = *ies.eids[0];
More information about the svn-commits
mailing list