From 64e2e1d5d85b3885c0ac1753030e34d6bc2a1d2d Mon Sep 17 00:00:00 2001 From: Scott Griepentrog Date: Wed, 22 Jan 2014 22:24:39 +0000 Subject: pbx.c: Pre-initialize timezone to avoid crash on destroy In ast_build_timing, initialize the timezone value to NULL in order to avoid deferencing an uninitialized value later when calling ast_destroy_timing. The timezone value could be uninitialized if ast_build_timing were to fail due to a zero length time string. (closes issue ASTERISK-22861) Reported by: Sebastian Murray-Roberts Review: https://reviewboard.asterisk.org/r/3134/ Patches: ast_build_timing-initialize-timezone.patch uploaded by coreyfarrell (license 5909) ........ Merged revisions 406241 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 406245 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 406264 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406269 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- utils/extconf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'utils') diff --git a/utils/extconf.c b/utils/extconf.c index 80491c016..f62553d09 100644 --- a/utils/extconf.c +++ b/utils/extconf.c @@ -4453,6 +4453,8 @@ int ast_build_timing(struct ast_timing *i, const char *info_in) char *info; int j, num_fields, last_sep = -1; + i->timezone = NULL; + /* Check for empty just in case */ if (ast_strlen_zero(info_in)) { return 0; @@ -4472,8 +4474,6 @@ int ast_build_timing(struct ast_timing *i, const char *info_in) /* save the timezone, if it is specified */ if (num_fields == 5) { i->timezone = ast_strdup(info + last_sep + 1); - } else { - i->timezone = NULL; } /* Assume everything except time */ -- cgit v1.2.3