mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-24 21:50:53 +00:00
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. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@127564 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -5128,9 +5128,11 @@ static int forward_message(struct ast_channel *chan, char *context, struct vm_st
|
||||
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;
|
||||
curmsg = vms->curmsg;
|
||||
@@ -10559,15 +10561,17 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
|
||||
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 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
|
||||
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 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user