[Asterisk-code-review] cdr/cdr adaptive odbc.c: Fix quoted identifier usage when in... (asterisk[master])

Elazar Broad asteriskteam at digium.com
Mon Jul 20 16:15:10 CDT 2015


Elazar Broad has uploaded a new change for review.

  https://gerrit.asterisk.org/937

Change subject: cdr/cdr_adaptive_odbc.c: Fix quoted identifier usage when inserting CDR records
......................................................................

cdr/cdr_adaptive_odbc.c: Fix quoted identifier usage when inserting CDR records

Commit a24ce38 added support for the use of quoted indentifiers when inserting
CDR records into the database. However, the if statement logic responsible for
determining whether to use those identifiers is reversed, resulting in a
reference to the quoted identifier character buffer which will be null, hence
null terminating the SQL query, resulting in a truncated statement which
fails to execute.

ASTERISK-25263
Reported by: Elazar Broad
Tested by: Elazar Broad

Change-Id: I40da47309b67cc1572207b1515dcc08ec9b1f644
---
M cdr/cdr_adaptive_odbc.c
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/37/937/1

diff --git a/cdr/cdr_adaptive_odbc.c b/cdr/cdr_adaptive_odbc.c
index f276959..8bd9d0d 100644
--- a/cdr/cdr_adaptive_odbc.c
+++ b/cdr/cdr_adaptive_odbc.c
@@ -740,9 +740,9 @@
 					continue;
 				}
 				if (quoted) {
-					ast_str_append(&sql, 0, "%s%s", separator, entry->name);
-				} else {
 					ast_str_append(&sql, 0, "%s%c%s%c", separator, tableptr->quoted_identifiers, entry->name, tableptr->quoted_identifiers);
+				} else {
+					ast_str_append(&sql, 0, "%s%s", separator, entry->name);
 				}
 				separator = ", ";
 			} else if (entry->filtervalue

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I40da47309b67cc1572207b1515dcc08ec9b1f644
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Elazar Broad <elazar at thebroadfamily.com>



More information about the asterisk-code-review mailing list