]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Prevent Undefined Capath Crash
authorJoshua Elson <joshelson@gmail.com>
Thu, 4 May 2017 22:28:55 +0000 (18:28 -0400)
committerJoshua Elson <joshelson@gmail.com>
Tue, 9 May 2017 14:21:55 +0000 (09:21 -0500)
It is possible to initialize a valid config without a capath
or cafile definition. This will cause a crash on a reload.

This fix ensures capath is always allocated.

ASTERISK-26983 #close

Change-Id: I63ff715d9d9023427543a5b8a4ba7b0d82533c12

main/manager.c

index c3628a3ef603c5ef760da8751c34d3cdeead1733..6604f6f2bfc353a75213cc66c768149226b1aaa4 100644 (file)
@@ -8765,6 +8765,10 @@ static void manager_shutdown(void)
        ami_tls_cfg.pvtfile = NULL;
        ast_free(ami_tls_cfg.cipher);
        ami_tls_cfg.cipher = NULL;
+       ast_free(ami_tls_cfg.cafile);
+       ami_tls_cfg.cafile = NULL;
+       ast_free(ami_tls_cfg.capath);
+       ami_tls_cfg.capath = NULL;
 
        ao2_global_obj_release(mgr_sessions);
 
@@ -8865,6 +8869,10 @@ static void manager_set_defaults(void)
        ami_tls_cfg.pvtfile = ast_strdup("");
        ast_free(ami_tls_cfg.cipher);
        ami_tls_cfg.cipher = ast_strdup("");
+       ast_free(ami_tls_cfg.cafile);
+       ami_tls_cfg.cafile = ast_strdup("");
+       ast_free(ami_tls_cfg.capath);
+       ami_tls_cfg.capath = ast_strdup("");
 }
 
 static int __init_manager(int reload, int by_external_config)