diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-03-31 18:59:42 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-03-31 18:59:42 +0000 |
commit | 87ed50c34b70fc6ef8945756cabc7687603cd18a (patch) | |
tree | 12fa4123d0d15031fb0892e1397526a172cbd1f1 /apps | |
parent | dde77c472594abe21061e38a14d3530abb1d2481 (diff) |
Don't die on a bad voicemail conf timezone entry (bug #1326)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@2591 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rwxr-xr-x | apps/app_voicemail.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 98a79e13a..417fa2ef4 100755 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -3422,16 +3422,21 @@ static int load_config(void) msg_format = ast_strdupa(var->value); if (msg_format != NULL) { timezone = strsep(&msg_format, "|"); - strncpy(z->name, var->name, sizeof(z->name) - 1); - strncpy(z->timezone, timezone, sizeof(z->timezone) - 1); - strncpy(z->msg_format, msg_format, sizeof(z->msg_format) - 1); - z->next = NULL; - if (zones) { - zonesl->next = z; - zonesl = z; + if (msg_format) { + strncpy(z->name, var->name, sizeof(z->name) - 1); + strncpy(z->timezone, timezone, sizeof(z->timezone) - 1); + strncpy(z->msg_format, msg_format, sizeof(z->msg_format) - 1); + z->next = NULL; + if (zones) { + zonesl->next = z; + zonesl = z; + } else { + zones = z; + zonesl = z; + } } else { - zones = z; - zonesl = z; + ast_log(LOG_WARNING, "Invalid tonezone definition at line %d\n", var->lineno); + free(z); } } else { ast_log(LOG_WARNING, "Out of memory while reading voicemail config\n"); |