From 293c9f68944bba86329b8846cb2d14cb11c318d8 Mon Sep 17 00:00:00 2001 From: Elazar Broad Date: Mon, 20 Jul 2015 16:59:32 -0400 Subject: [PATCH] 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 --- cdr/cdr_adaptive_odbc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cdr/cdr_adaptive_odbc.c b/cdr/cdr_adaptive_odbc.c index f276959a05..8bd9d0da64 100644 --- a/cdr/cdr_adaptive_odbc.c +++ b/cdr/cdr_adaptive_odbc.c @@ -740,9 +740,9 @@ static int odbc_log(struct ast_cdr *cdr) 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 -- 2.47.2