diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-05-08 06:22:37 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-05-08 06:22:37 +0000 |
commit | ffee9f0dec392ba3dca2c1b839f6efb11185364f (patch) | |
tree | 8a8f30424a2dcc1a4a53ef1de16e073d9efb63b0 /apps | |
parent | 5d365394535b3192f861a36874d1d69a626870f5 (diff) |
Merged revisions 63359 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r63359 | tilghman | 2007-05-08 01:20:16 -0500 (Tue, 08 May 2007) | 2 lines
Issue 9527 - upon entering a folder, no message is selected (curmsg == -1), so deleting causes memory corruption (beyond bounds)
........
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@63360 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_voicemail.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 615178912..482c6dbd2 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -6579,21 +6579,24 @@ static int vm_execmain(struct ast_channel *chan, void *data) } break; case '7': - vms.deleted[vms.curmsg] = !vms.deleted[vms.curmsg]; - if (useadsi) - adsi_delete(chan, &vms); - if (vms.deleted[vms.curmsg]) - cmd = ast_play_and_wait(chan, "vm-deleted"); - else - cmd = ast_play_and_wait(chan, "vm-undeleted"); - if (ast_test_flag((&globalflags), VM_SKIPAFTERCMD)) { - if (vms.curmsg < vms.lastmsg) { - vms.curmsg++; - cmd = play_message(chan, vmu, &vms); - } else { - cmd = ast_play_and_wait(chan, "vm-nomore"); + if (vms.curmsg >= 0 && vms.curmsg <= vms.lastmsg) { + vms.deleted[vms.curmsg] = !vms.deleted[vms.curmsg]; + if (useadsi) + adsi_delete(chan, &vms); + if (vms.deleted[vms.curmsg]) + cmd = ast_play_and_wait(chan, "vm-deleted"); + else + cmd = ast_play_and_wait(chan, "vm-undeleted"); + if (ast_test_flag((&globalflags), VM_SKIPAFTERCMD)) { + if (vms.curmsg < vms.lastmsg) { + vms.curmsg++; + cmd = play_message(chan, vmu, &vms); + } else { + cmd = ast_play_and_wait(chan, "vm-nomore"); + } } - } + } else /* Delete not valid if we haven't selected a message */ + cmd = 0; #ifdef IMAP_STORAGE deleted = 1; #endif |