[asterisk-bugs] [Asterisk 0010300]: memory corruption on freebsd sparc64
noreply at bugs.digium.com
noreply at bugs.digium.com
Thu Jul 26 15:55:50 CDT 2007
A NOTE has been added to this issue.
======================================================================
http://bugs.digium.com/view.php?id=10300
======================================================================
Reported By: mattias04
Assigned To:
======================================================================
Project: Asterisk
Issue ID: 10300
Category: Channels/chan_sip/General
Reproducibility: always
Severity: major
Priority: normal
Status: new
Asterisk Version: 1.4.9
SVN Branch (only for SVN checkouts, not tarball releases): N/A
SVN Revision (number only!):
Disclaimer on File?: N/A
Request Review:
======================================================================
Date Submitted: 07-25-2007 09:40 CDT
Last Modified: 07-26-2007 15:55 CDT
======================================================================
Summary: memory corruption on freebsd sparc64
Description:
after calling strchr in function set_address_from_contact()
...
/* Grab host */
host = strchr(contact, '@');
...
memory gets corrupted.
strchr should not alter input string.
I suspect that
...
/* Work on a copy */
contact = ast_strdupa(pvt->fullcontact);
...
might have something to do with it.
When doing some debugging I get this:
njord*CLI>
[Jul 25 14:11:43] WARNING[22832]: chan_sip.c:7779
set_address_from_contact: MWE DEBUG: pvt->fullcontact :
'sip:020252500 at 83.140.41.50'
[Jul 25 14:11:43] WARNING[22832]: chan_sip.c:7781
set_address_from_contact: MWE DEBUG: contact :
'sip:020252500 at 83.140.41.50'
[Jul 25 14:11:43] WARNING[22832]: chan_sip.c:7793
set_address_from_contact: MWE DEBUG: contact : '020252500 at 83.140.41.50'
[Jul 25 14:11:43] WARNING[22832]: chan_sip.c:7795
set_address_from_contact: MWE DEBUG: strchr contact :
'020252500 at 83.140.41.'
[Jul 25 14:11:43] WARNING[22832]: chan_sip.c:7796
set_address_from_contact: MWE DEBUG: strchr host : '@83.140.41.'
[Jul 25 14:11:43] WARNING[22832]: chan_sip.c:7810
set_address_from_contact: MWE DEBUG: contact : '020252500'
[Jul 25 14:11:43] WARNING[22832]: chan_sip.c:7812
set_address_from_contact: MWE DEBUG: contact strsep : '020252500'
[Jul 25 14:11:43] WARNING[22832]: chan_sip.c:7813
set_address_from_contact: MWE DEBUG: host : '83.140.41.'
[Jul 25 14:11:43] WARNING[22832]: chan_sip.c:7815
set_address_from_contact: MWE DEBUG: host strsep : '83.140.41.'
[Jul 25 14:11:43] WARNING[22832]: chan_sip.c:7821
set_address_from_contact: Invalid host name in Contact: (can't resolve in
DNS) : '83.140.41.'
[Jul 25 14:11:50] WARNING[22832]: chan_sip.c:12459 handle_response: Remote
host can't match request BYE to call
'2014421459e28760110e8f3a50dae531 at cx-cust-shg
As you can see the IP address 83.140.41.50 get truncated.
======================================================================
----------------------------------------------------------------------
mattias04 - 07-26-07 15:55
----------------------------------------------------------------------
The version of gcc is (default in FreeBSD 6.2):
[root at njord ~/bin/spamcop]# gcc --version
gcc (GCC) 3.4.6 [FreeBSD] 20060305
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
Both Linux and FreeBSD man pages for alloca discourages the use of
alloca(), I have never used the function myself, so I have no opinoin
here.
I can cleary see that it is a neet way of allocating memory.
Issue History
Date Modified Username Field Change
======================================================================
07-26-07 15:55 mattias04 Note Added: 0067946
======================================================================
More information about the asterisk-bugs
mailing list