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

Scott Griepentrog asteriskteam at digium.com
Thu Sep 17 16:38:08 CDT 2015


Scott Griepentrog has uploaded a new change for review.

  https://gerrit.asterisk.org/1279

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/79/1279/1

diff --git a/res/res_config_sqlite.c b/res/res_config_sqlite.c
index fe2fb3c..94b0b5a 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/1279
To unsubscribe, visit https://gerrit.asterisk.org/settings

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



More information about the asterisk-code-review mailing list