[Asterisk-code-review] app_voicemail: Prevent crash when saving message with realtime voicemail (asterisk[16])
Friendly Automation
asteriskteam at digium.com
Mon Jan 20 09:20:54 CST 2020
Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/13632 )
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 184c4f9..d8a63ec 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -4786,11 +4786,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/+/13632
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I756c5dd0299c77f4274368f7c99eb0464367466c
Gerrit-Change-Number: 13632
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/52e48c06/attachment.html>
More information about the asterisk-code-review
mailing list