aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-01-28 18:38:56 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-01-28 18:38:56 +0000
commit9014a61313c750913e417105a05ea4ac41eb5ab1 (patch)
tree42b6ef97cc4ba92e89369b143cb040f9a5c6e304
parent84e71acc2aca2d7f555a5444a1237743768a40cb (diff)
Merged revisions 100629 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r100629 | russell | 2008-01-28 12:34:20 -0600 (Mon, 28 Jan 2008) | 5 lines For some reason, the use of this strdupa() is leading to memory corruption on freebsd sparc64. This trivial workaround fixes it. (closes issue #10300, closes issue #11857, reported by mattias04 and Home-of-the-Brave) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@100630 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--channels/chan_sip.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 159e194f9..b13759e21 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -9445,9 +9445,10 @@ static int set_address_from_contact(struct sip_pvt *pvt)
struct ast_hostent ahp;
int port;
char *host, *pt;
+ char contact_buf[256];
+ char contact2_buf[256];
char *contact, *contact2;
-
if (ast_test_flag(&pvt->flags[0], SIP_NAT_ROUTE)) {
/* NAT: Don't trust the contact field. Just use what they came to us
with. */
@@ -9455,10 +9456,12 @@ static int set_address_from_contact(struct sip_pvt *pvt)
return 0;
}
-
/* Work on a copy */
- contact = ast_strdupa(pvt->fullcontact);
- contact2 = ast_strdupa(pvt->fullcontact);
+ ast_copy_string(contact_buf, pvt->fullcontact, sizeof(contact_buf));
+ ast_copy_string(contact2_buf, pvt->fullcontact, sizeof(contact2_buf));
+ contact = contact_buf;
+ contact2 = contact2_buf;
+
/* We have only the part in <brackets> here so we just need to parse a SIP URI.*/
if (pvt->socket.type == SIP_TRANSPORT_TLS) {