[Asterisk-cvs] asterisk/apps app_voicemail.c,1.70,1.71

markster at lists.digium.com markster at lists.digium.com
Wed Mar 31 14:00:59 CST 2004


Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv10260/apps

Modified Files:
	app_voicemail.c 
Log Message:
Don't die on a bad voicemail conf timezone entry (bug #1326)


Index: app_voicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- app_voicemail.c	29 Mar 2004 08:20:35 -0000	1.70
+++ app_voicemail.c	31 Mar 2004 18:59:42 -0000	1.71
@@ -3422,16 +3422,21 @@
 							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");




More information about the svn-commits mailing list