[Asterisk-code-review] app_voicemail/IMAP: check mailstream not NULL in leave_voicemail (...asterisk[master])

Joshua Colp asteriskteam at digium.com
Mon Aug 19 07:34:45 CDT 2019


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/asterisk/+/12741 )

Change subject: app_voicemail/IMAP: check mailstream not NULL in leave_voicemail
......................................................................

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
---
M apps/app_voicemail.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Benjamin Keith Ford: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Approved for Submit



diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 405dddf..a479728 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -7179,7 +7179,7 @@
 #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)) {

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/12741
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Ib66c57c1f1ba97774e447b36349198e2626a8d7c
Gerrit-Change-Number: 12741
Gerrit-PatchSet: 1
Gerrit-Owner: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190819/037d9d19/attachment.html>


More information about the asterisk-code-review mailing list