[Asterisk-code-review] app_voicemail: Prevent crash when saving message with realtime voicemail (asterisk[13])

Friendly Automation asteriskteam at digium.com
Mon Jan 20 09:11:05 CST 2020


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/13596 )

Change subject: app_voicemail: Prevent crash when saving message with realtime voicemail
......................................................................

app_voicemail: Prevent crash when saving message with realtime voicemail

ast_store_realtime() is not NULL tolerant, so we need to initialize
the field values we pass to it to the empty string to avoid a crash.

ASTERISK-23739 #close
Reported by: Stas Kobzar

Change-Id: I756c5dd0299c77f4274368f7c99eb0464367466c
---
M apps/app_voicemail.c
1 file changed, 6 insertions(+), 2 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index f89248b..46f8f7b 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -4769,11 +4769,15 @@
 static void copy_plain_file(char *frompath, char *topath)
 {
 	char frompath2[PATH_MAX], topath2[PATH_MAX];
-	struct ast_variable *tmp,*var = NULL;
-	const char *origmailbox = NULL, *context = NULL, *macrocontext = NULL, *exten = NULL, *priority = NULL, *callerchan = NULL, *callerid = NULL, *origdate = NULL, *origtime = NULL, *category = NULL, *duration = NULL;
+	struct ast_variable *tmp, *var = NULL;
+	const char *origmailbox = "", *context = "", *macrocontext = "", *exten = "";
+	const char *priority = "", *callerchan = "", *callerid = "", *origdate = "";
+	const char *origtime = "", *category = "", *duration = "";
+
 	ast_filecopy(frompath, topath, NULL);
 	snprintf(frompath2, sizeof(frompath2), "%s.txt", frompath);
 	snprintf(topath2, sizeof(topath2), "%s.txt", topath);
+
 	if (ast_check_realtime("voicemail_data")) {
 		var = ast_load_realtime("voicemail_data", "filename", frompath, SENTINEL);
 		/* This cycle converts ast_variable linked list, to va_list list of arguments, may be there is a better way to do it? */

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

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I756c5dd0299c77f4274368f7c99eb0464367466c
Gerrit-Change-Number: 13596
Gerrit-PatchSet: 2
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200120/89abdaec/attachment.html>


More information about the asterisk-code-review mailing list