[asterisk-commits] res/res sorcery config: Prevent crash from misconfigured sor... (asterisk[master])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sun Jul 19 09:20:51 CDT 2015
Joshua Colp has submitted this change and it was merged.
Change subject: res/res_sorcery_config: Prevent crash from misconfigured sorcery.conf
......................................................................
res/res_sorcery_config: Prevent crash from misconfigured sorcery.conf
Misconfiguring sorcery.conf with a 'config' wizard with no extra data
will currently crash Asterisk on startup, as the wizard requires a comma
delineated list to parse. This patch updates res_sorcery_config to check
for the presence of the data before it starts manipulating it.
Change-Id: I4c97512e8258bc82abe190627a9206c28f5d3847
---
M res/res_sorcery_config.c
1 file changed, 10 insertions(+), 1 deletion(-)
Approvals:
Anonymous Coward #1000019: Verified
Joshua Colp: Looks good to me, approved
diff --git a/res/res_sorcery_config.c b/res/res_sorcery_config.c
index b6ad0cc..092cc41 100644
--- a/res/res_sorcery_config.c
+++ b/res/res_sorcery_config.c
@@ -348,9 +348,18 @@
static void *sorcery_config_open(const char *data)
{
- char *tmp = ast_strdupa(data), *filename = strsep(&tmp, ","), *option;
+ char *tmp;
+ char *filename;
+ char *option;
struct sorcery_config *config;
+ if (ast_strlen_zero(data)) {
+ return NULL;
+ }
+
+ tmp = ast_strdupa(data);
+ filename = strsep(&tmp, ",");
+
if (ast_strlen_zero(filename) || !(config = ao2_alloc_options(sizeof(*config) + strlen(filename) + 1, sorcery_config_destructor, AO2_ALLOC_OPT_LOCK_NOLOCK))) {
return NULL;
}
--
To view, visit https://gerrit.asterisk.org/930
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I4c97512e8258bc82abe190627a9206c28f5d3847
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
More information about the asterisk-commits
mailing list