[asterisk-commits] russell: branch 1.4 r100629 - /branches/1.4/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jan 28 12:34:21 CST 2008


Author: russell
Date: Mon Jan 28 12:34:20 2008
New Revision: 100629

URL: http://svn.digium.com/view/asterisk?view=rev&rev=100629
Log:
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)

Modified:
    branches/1.4/channels/chan_sip.c

Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=100629&r1=100628&r2=100629
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Mon Jan 28 12:34:20 2008
@@ -7936,8 +7936,8 @@
 	struct ast_hostent ahp;
 	int port;
 	char *c, *host, *pt;
+	char contact_buf[256];
 	char *contact;
-
 
 	if (ast_test_flag(&pvt->flags[0], SIP_NAT_ROUTE)) {
 		/* NAT: Don't trust the contact field.  Just use what they came to us
@@ -7946,9 +7946,9 @@
 		return 0;
 	}
 
-
 	/* Work on a copy */
-	contact = ast_strdupa(pvt->fullcontact);
+	ast_copy_string(contact_buf, pvt->fullcontact, sizeof(contact_buf));
+	contact = contact_buf;
 
 	/* Make sure it's a SIP URL */
 	if (strncasecmp(contact, "sip:", 4)) {




More information about the asterisk-commits mailing list