[svn-commits] tilghman: trunk r127564 - /trunk/apps/app_voicemail.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jul 2 15:52:27 CDT 2008


Author: tilghman
Date: Wed Jul  2 15:52:27 2008
New Revision: 127564

URL: http://svn.digium.com/view/asterisk?view=rev&rev=127564
Log:
Fix some crashlike bugs because flag could be NULL in play_record_review().
(Closes issue #12892)
Reported by: jaroth
Patch originally by jaroth, fixed by me.

Modified:
    trunk/apps/app_voicemail.c

Modified: trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_voicemail.c?view=diff&rev=127564&r1=127563&r2=127564
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Wed Jul  2 15:52:27 2008
@@ -5128,8 +5128,10 @@
 	int valid_extensions = 0;
 	char *dir;
 	int curmsg;
-	char *urgent_str = urgent ? "Urgent" : "";
+	char urgent_str[7] = "";
 	char tmptxtfile[PATH_MAX];
+
+	ast_copy_string(urgent_str, urgent ? "Urgent" : "", sizeof(urgent_str));
 
 	if (vms == NULL) return -1;
 	dir = vms->curdir;
@@ -10559,15 +10561,17 @@
 		case '4':
 			if (outsidecaller) {  /* only mark vm messages */
 				/* Mark Urgent */
-				if (!ast_strlen_zero(flag) && strcmp(flag, "Urgent")) {
+				if ((flag && ast_strlen_zero(flag)) || (!ast_strlen_zero(flag) && strcmp(flag, "Urgent"))) {
 					ast_verbose(VERBOSE_PREFIX_3 "marking message as Urgent\n");
 					ast_debug(1000, "This message is too urgent!\n");
 					res = ast_play_and_wait(chan, "vm-marked-urgent");
 					strcpy(flag, "Urgent");
-				} else {
+				} else if (flag) {
 					ast_verbose(VERBOSE_PREFIX_3 "UNmarking message as Urgent\n");
 					res = ast_play_and_wait(chan, "vm-urgent-removed");
 					strcpy(flag, "");
+				} else {
+					ast_play_and_wait(chan, "vm-sorry");
 				}
 				cmd = 0;
 			} else {
@@ -10610,8 +10614,10 @@
 					ast_play_and_wait(chan, "vm-msgsaved");
 					cmd = '0';
 				} else if (cmd == '4') {
-					ast_play_and_wait(chan, "vm-marked-urgent");
-					strcpy(flag, "Urgent");
+					if (flag) {
+						ast_play_and_wait(chan, "vm-marked-urgent");
+						strcpy(flag, "Urgent");
+					}
 					ast_play_and_wait(chan, "vm-msgsaved");
 					cmd = '0';
 				} else {
@@ -10630,10 +10636,10 @@
 			if (message_exists) {
 				cmd = ast_play_and_wait(chan, "vm-review");
 				if (!cmd && outsidecaller) {
-					if (!ast_strlen_zero(flag) && strcmp(flag, "Urgent")) {
+					if ((flag && ast_strlen_zero(flag)) || (!ast_strlen_zero(flag) && strcmp(flag, "Urgent"))) {
 						cmd = ast_play_and_wait(chan, "vm-review-urgent");
-					} else {
-						cmd = ast_play_and_wait(chan, "vm-review-unurgent");
+					} else if (flag) {
+						cmd = ast_play_and_wait(chan, "vm-review-nonurgent");
 					}
 				}
 			} else {




More information about the svn-commits mailing list