[Asterisk-code-review] CHAOS: avoid crash if string create fails (asterisk[master])

Scott Griepentrog asteriskteam at digium.com
Thu Sep 17 16:37:46 CDT 2015


Scott Griepentrog has uploaded a new change for review.

  https://gerrit.asterisk.org/1278

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, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/78/1278/1

diff --git a/res/res_config_sqlite.c b/res/res_config_sqlite.c
index 5659b4e..d58cfa9 100644
--- a/res/res_config_sqlite.c
+++ b/res/res_config_sqlite.c
@@ -786,6 +786,9 @@
 		return -1;
 	}
 
+	if (!sql1 || !sql2) {
+		return -1;
+	}
 	ast_str_set(&sql1, 0, "INSERT INTO %s (", cdr_table);
 	ast_str_set(&sql2, 0, ") VALUES (");
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib9c338bdc1e53fb8b81366f0b39482b83ef56ce0
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Scott Griepentrog <sgriepentrog at digium.com>



More information about the asterisk-code-review mailing list