Summary: | ASTERISK-16999: [patch] asterisk crash when setting outbound mwi subscription in sip.conf | ||||
Reporter: | Guillaume Bour (gbour) | Labels: | |||
Date Opened: | 2010-11-22 03:58:16.000-0600 | Date Closed: | 2012-05-16 10:22:24 | ||
Priority: | Critical | Regression? | No | ||
Status: | Closed/Complete | Components: | Channels/chan_sip/General | ||
Versions: | Frequency of Occurrence | ||||
Related Issues: |
| ||||
Environment: | Attachments: | ( 0) gdb_trace.txt ( 1) m18350.patch ( 2) sip.conf | |||
Description: | We setting an outbound mwi subscription line in sip.conf, asterisk crash at start (on loading sip configuration) tested with asterisk 1.8.0 tarball and svn trunk. ****** STEPS TO REPRODUCE ****** * add "mwi => 1234:password@mysipprovider.com/1234" in sip.conf [general] section * (re)start asterisk * it crash when loading sip module ****** ADDITIONAL INFORMATION ****** The problem comes from channels/chan_sip.c:sip_subscribe_mwi function. This is a misuse of *sip_parse_host* function, where *username* returned value is only host part, not "username@host". Thus at line 7726, hostname variable is set to NULL. And asterisk crash at line 7730 (strchr did not expect a NULL value as argument) | ||||
Comments: | By: Leif Madsen (lmadsen) 2010-12-07 09:41:36.000-0600 Thanks for the thorough report! By: Bradley Watkins (marquis) 2010-12-08 19:29:22.000-0600 Can you try the attached patch (m18350.patch) to sanity-check it for me? The parsing of the mwi => lines was wrong in at least a couple of ways, and this cleans it up to properly support the documented syntax. It also adds a tiny bit of documentation for clarity. This now cleanly parses a fairly wide variety of possible permutations according to my tests. By: Guillaume Bour (gbour) 2010-12-09 04:03:41.000-0600 It works perfectly for me. Congrats for the patch. But I have another problem. I don't know if its related: when doing *sip reload*, mwi entries are append to existing ones, even when they are the sames *CLI> sip show mwi Host Username Mailbox Subscribed 1.2.99.8:5060 a miee No 123.45.334.23:7785 guillaume mevoeee No 1.2.3.4:5060 mwione mevooo No *CLI> sip reload *CLI> sip show mwi Host Username Mailbox Subscribed 1.2.99.8:5060 a miee No 123.45.334.23:7785 guillaume mevoeee No 1.2.3.4:5060 mwione mevooo No 1.2.99.8:5060 a miee No 123.45.334.23:7785 guillaume mevoeee No 1.2.3.4:5060 mwione mevooo No By: Bradley Watkins (marquis) 2010-12-09 06:00:45.000-0600 That would definitely be unrelated to this issue, but obviously it's a bug. Can you file a new issue with this information and I'll take a look at it? Thanks for the feedback, by the way. I'll throw this up on Reviewboard and hopefully it can be committed soon. By: Bradley Watkins (marquis) 2010-12-09 08:51:54.000-0600 Submitted for review: https://reviewboard.asterisk.org/r/1053/ By: Digium Subversion (svnbot) 2010-12-17 11:26:32.000-0600 Repository: asterisk Revision: 298773 U branches/1.8/channels/chan_sip.c U branches/1.8/configs/sip.conf.sample ------------------------------------------------------------------------ r298773 | marquis | 2010-12-17 11:26:32 -0600 (Fri, 17 Dec 2010) | 10 lines Fix parsing of mwi => lines in sip.conf Reworking parsing of mwi => lines to resolve a segfault. Also add a set of unit tests for the function that does the parsing. (closes issue ASTERISK-16999) Reported by: gbour Tested by: Marquis, gbour Review: https://reviewboard.asterisk.org/r/1053/ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=298773 By: Digium Subversion (svnbot) 2010-12-17 11:29:10.000-0600 Repository: asterisk Revision: 298774 _U trunk/ U trunk/channels/chan_sip.c U trunk/configs/sip.conf.sample ------------------------------------------------------------------------ r298774 | marquis | 2010-12-17 11:29:10 -0600 (Fri, 17 Dec 2010) | 17 lines Merged revisions 298773 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r298773 | marquis | 2010-12-17 12:26:31 -0500 (Fri, 17 Dec 2010) | 10 lines Fix parsing of mwi => lines in sip.conf Reworking parsing of mwi => lines to resolve a segfault. Also add a set of unit tests for the function that does the parsing. (closes issue ASTERISK-16999) Reported by: gbour Tested by: Marquis, gbour Review: https://reviewboard.asterisk.org/r/1053/ ........ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=298774 By: Michael Keuter (mkeuter) 2012-05-11 16:51:30.339-0500 I do have exactly the same issue in Asterisk 1.8.13.0-rc1 and 10.2.0-rc2. I cannot supply a backtrace because it's embedded system. asterisk[12979]: segfault at 60 ip 40b76aaf sp 40fee190 error 4 in chan_sip.so[40af9000+a3000] By: Stefan Schmidt (schmidts) 2012-05-15 12:32:35.244-0500 reopen on behalve of Michael Keuter in asterisk-dev list: > Can someone please reopen https://issues.asterisk.org/jira/browse/ASTERISK-16999 > as the bug is not fixed completely. > > Michael > > http://www.mksolutions.info By: Michael Keuter (mkeuter) 2012-05-15 16:01:02.021-0500 The Steps to reproduce are still the same as in the description above. On 1.8.13.0-rc1 and 10.5.0-rc1 (and older) By: Matt Jordan (mjordan) 2012-05-16 09:42:48.389-0500 Michael: While the steps to reproduce this issue are the same, the seg fault actually is being caused by a different mechanism. ASTERISK-19827 already documents this same problem - I've reproduced your crash and its the same root cause. As such I'm going to close this issue again, and link it to ASTERISK-19827. Matt |