[asterisk-commits] mmichelson: trunk r116590 - /trunk/apps/app_voicemail.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 15 10:13:11 CDT 2008


Author: mmichelson
Date: Thu May 15 10:13:11 2008
New Revision: 116590

URL: http://svn.digium.com/view/asterisk?view=rev&rev=116590
Log:
Prevent crashes from occurring due to a strcmp of a NULL pointer.

(closes issue #12661)
Reported by: jaroth
Patches:
      urgentcompare.patch uploaded by jaroth (license 50)


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=116590&r1=116589&r2=116590
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Thu May 15 10:13:11 2008
@@ -3450,7 +3450,7 @@
 
 	ast_log(AST_LOG_NOTICE, "Copying message from %s@%s to %s@%s\n", vmu->mailbox, vmu->context, recip->mailbox, recip->context);
 
-	if (!strcmp(flag, "Urgent")) { /* If urgent, copy to Urgent folder */
+	if (!ast_strlen_zero(flag) && !strcmp(flag, "Urgent")) { /* If urgent, copy to Urgent folder */
 		create_dirpath(todir, sizeof(todir), recip->context, recip->mailbox, "Urgent");
 	} else {
 		create_dirpath(todir, sizeof(todir), recip->context, recip->mailbox, "INBOX");
@@ -4121,7 +4121,7 @@
 						}
 					}
 #ifndef IMAP_STORAGE
-					if (!strcmp(flag, "Urgent")) { /* If this is an Urgent message */
+					if (!ast_strlen_zero(flag) && !strcmp(flag, "Urgent")) { /* If this is an Urgent message */
 						/* Move the message from INBOX to Urgent folder if this is urgent! */
 						char sfn[PATH_MAX];
 						char dfn[PATH_MAX];
@@ -10502,7 +10502,7 @@
 		case '4':
 			if (outsidecaller) {  /* only mark vm messages */
 				/* Mark Urgent */
-				if (strcmp(flag, "Urgent")) {
+				if (!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");
@@ -10573,7 +10573,7 @@
 			if (message_exists) {
 				cmd = ast_play_and_wait(chan, "vm-review");
 				if (!cmd && outsidecaller) {
-					if (strcmp(flag, "Urgent")) {
+					if (!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");




More information about the asterisk-commits mailing list