From b3b3c0181e6b2fdc38f7044a347081909024be71 Mon Sep 17 00:00:00 2001 From: Sean Bright Date: Fri, 1 Sep 2017 10:51:06 -0400 Subject: [PATCH] app_directory: Handle a NULL mailbox without crashing ASTERISK-27241 #close Reported by: David Moore Change-Id: Ibbbca85517b04c315406ebfe3b6f7e0763daedc6 --- apps/app_directory.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/app_directory.c b/apps/app_directory.c index b75e857..c6be071 100644 --- a/apps/app_directory.c +++ b/apps/app_directory.c @@ -511,6 +511,11 @@ static struct ast_config *realtime_directory(char *context) const char *mailbox = ast_variable_retrieve(rtdata, category, "mailbox"); const char *ctx = ast_variable_retrieve(rtdata, category, "context"); + if (ast_strlen_zero(mailbox)) { + ast_log(LOG_WARNING, "Skipping result with missing or empty mailbox\n"); + continue; + } + fullname = ast_variable_retrieve(rtdata, category, "fullname"); hidefromdir = ast_variable_retrieve(rtdata, category, "hidefromdir"); if (ast_true(hidefromdir)) { -- 2.7.4