From: Alexei Gradinari Date: Wed, 14 Aug 2019 19:52:01 +0000 (-0400) Subject: app_voicemail/IMAP: check mailstream not NULL in leave_voicemail X-Git-Tag: 16.6.0-rc1~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff180a5bfc3090485ee7b2746ce7bee58e754746;p=thirdparty%2Fasterisk.git app_voicemail/IMAP: check mailstream not NULL in leave_voicemail 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 --- diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index c0edd447b5..a7cf8dee23 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -7247,7 +7247,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)) {