diff options
author | Scott Griepentrog <scott@griepentrog.com> | 2015-09-17 16:34:41 -0500 |
---|---|---|
committer | Scott Griepentrog <scott@griepentrog.com> | 2015-09-18 13:49:55 -0500 |
commit | d9723d242a2220e13e0217e5d2ff4fb00f08ca06 (patch) | |
tree | ba1aa4359f5abe77d9bba0e463721f58e7f819c6 /res | |
parent | e47396721f9c73b16ac7c7632dcd530f4e5b06c7 (diff) |
CHAOS: avoid crash if string create fails
Validate string buffer allocation before using them.
ASTERISK-25323
Change-Id: Ib9c338bdc1e53fb8b81366f0b39482b83ef56ce0
Diffstat (limited to 'res')
-rw-r--r-- | res/res_config_sqlite.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/res/res_config_sqlite.c b/res/res_config_sqlite.c index 5659b4e41..4375c3960 100644 --- a/res/res_config_sqlite.c +++ b/res/res_config_sqlite.c @@ -781,8 +781,16 @@ static int cdr_handler(struct ast_cdr *cdr) struct ast_str *sql1 = ast_str_create(160), *sql2 = ast_str_create(16); int first = 1; + if (!sql1 || !sql2) { + ast_free(sql1); + ast_free(sql2); + return -1; + } + if (!tbl) { ast_log(LOG_WARNING, "No such table: %s\n", cdr_table); + ast_free(sql1); + ast_free(sql2); return -1; } |