[Home]

Summary:ASTERISK-17992: chan_mgcp segmentation fault
Reporter:Nenad Kljajic (foundanswer)Labels:
Date Opened:2011-06-09 03:33:38Date Closed:2011-06-13 00:53:30
Priority:MajorRegression?
Status:Closed/CompleteComponents:Channels/chan_mgcp
Versions:1.8.4 Frequency of
Occurrence
Related
Issues:
Environment:Centos 5.2Attachments:
Description:chan_mgcp crashes when unknown gateway tries to register, due to null pointer reference.


--- channels/chan_mgcp.c        2011-06-09 09:59:11.000000000 +0200
+++ channels/chan_mgcp.c        2011-06-09 10:08:27.000000000 +0200
@@ -1775,7 +1775,7 @@
                       *c = '\0';
               }
       }
-       for (g = gateways ? gateways : find_realtime_gw(name, at, sin); g; g = g->next ? g->next : find_realtime_gw(name, at, sin)) {
+       for (g = gateways ? gateways : find_realtime_gw(name, at, sin); g; g = g ? (g->next ? g->next : find_realtime_gw(name, at, sin)) : NULL ) {
               if ((!name || !strcasecmp(g->name, at)) &&
                   (sin || g->addr.sin_addr.s_addr || g->defaddr.sin_addr.s_addr)) {
                       /* Found the gateway.  If it's dynamic, save it's address -- now for the endpoint */
Comments:By: Nenad Kljajic (foundanswer) 2011-06-13 00:53:30.347-0500

https://issues.asterisk.org/jira/browse/ASTERISK-17797
is the propper fix