[asterisk-commits] CHAOS: avoid crash if string create fails (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Sep 19 08:22:46 CDT 2015


Joshua Colp has submitted this change and it was merged.

Change subject: CHAOS: avoid crash if string create fails
......................................................................


CHAOS: avoid crash if string create fails

Validate string buffer allocation before using them.

ASTERISK-25323

Change-Id: Ib9c338bdc1e53fb8b81366f0b39482b83ef56ce0
---
M res/res_config_sqlite.c
1 file changed, 8 insertions(+), 0 deletions(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/res/res_config_sqlite.c b/res/res_config_sqlite.c
index 5659b4e..4375c39 100644
--- a/res/res_config_sqlite.c
+++ b/res/res_config_sqlite.c
@@ -781,8 +781,16 @@
 	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;
 	}
 

-- 
To view, visit https://gerrit.asterisk.org/1278
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib9c338bdc1e53fb8b81366f0b39482b83ef56ce0
Gerrit-PatchSet: 4
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Scott Griepentrog <sgriepentrog at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-commits mailing list