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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jul 20 18:09:03 CDT 2015


Matt Jordan has submitted this change and it was merged.

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 #close
Reported by: Elazar Broad
Tested by: Elazar Broad

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

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



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: merged
Gerrit-Change-Id: I40da47309b67cc1572207b1515dcc08ec9b1f644
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Elazar Broad <elazar at thebroadfamily.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-commits mailing list