]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix segfault when reloading chan_misdn.
authorJeff Peeler <jpeeler@digium.com>
Mon, 17 Aug 2009 16:34:56 +0000 (16:34 +0000)
committerJeff Peeler <jpeeler@digium.com>
Mon, 17 Aug 2009 16:34:56 +0000 (16:34 +0000)
If more ports were specified than configured in misdn.conf a reload would crash
asterisk. The problem was the unconfigured port was using data from the
previously configured port. When the data for an unconfigured port was freed a
crash would result from the double free.

(closes issue #12113)
Reported by: agupta
Patches:
      bug12113.patch uploaded by jpeeler (license 325)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@212498 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/misdn_config.c

index 1cbd190212f9b3a4ce8ef3dac782956778482e1e..9d947f726a588c485a179abbc0637ea75f2d2ccd 100644 (file)
@@ -1001,6 +1001,11 @@ static void _build_port_config (struct ast_variable *v, char *cat)
        }
 
        for (i = 0; i < (max_ports + 1); ++i) {
+               if (i > 0 && cfg_for_ports[0]) {
+                       /* default category, will populate the port_cfg with additional port
+                       categories in subsequent calls to this function */
+                       memset(cfg_tmp, 0, sizeof(cfg_tmp));
+               }
                if (cfg_for_ports[i]) {
                        memcpy(port_cfg[i], cfg_tmp, sizeof(cfg_tmp));
                }