]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
app_voicemail/IMAP: check mailstream not NULL in leave_voicemail
authorAlexei Gradinari <alex2grad@gmail.com>
Wed, 14 Aug 2019 19:52:01 +0000 (15:52 -0400)
committerGeorge Joseph <gjoseph@digium.com>
Thu, 15 Aug 2019 15:08:30 +0000 (10:08 -0500)
The function leave_voicemail checks if expungeonhangup is set,
but does not check if IMAP stream is closed,
so it could call imap function with NULL stream.
This leads to segfault.

ASTERISK-28505 #close

Change-Id: Ib66c57c1f1ba97774e447b36349198e2626a8d7c

apps/app_voicemail.c

index 405dddf025c49b1c3e324960a5f397acde00783e..a4797282f03c0299d0f7f2ac9ecad2aca30c1372 100644 (file)
@@ -7179,7 +7179,7 @@ leave_vm_out:
 #ifdef IMAP_STORAGE
        /* expunge message - use UID Expunge if supported on IMAP server*/
        ast_debug(3, "*** Checking if we can expunge, expungeonhangup set to %d\n", expungeonhangup);
-       if (expungeonhangup == 1) {
+       if (expungeonhangup == 1 && vms->mailstream != NULL) {
                ast_mutex_lock(&vms->lock);
 #ifdef HAVE_IMAP_TK2006
                if (LEVELUIDPLUS (vms->mailstream)) {