From 6906e0aa3c35c171fc1cb73c1796fc14a500e7b1 Mon Sep 17 00:00:00 2001 From: Sean Bright Date: Wed, 15 Jan 2020 15:29:00 -0500 Subject: [PATCH] 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 --- apps/app_voicemail.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index f89248b518..46f8f7b2c1 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -4769,11 +4769,15 @@ static int copy(char *infile, char *outfile) 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? */ -- 2.47.2