[asterisk-bugs] [JIRA] (ASTERISK-25263) CDR insert failure due to reversed if logic

Elazar Broad (JIRA) noreply at issues.asterisk.org
Fri Jul 17 14:50:33 CDT 2015


Elazar Broad created ASTERISK-25263:
---------------------------------------

             Summary: CDR insert failure due to reversed if logic
                 Key: ASTERISK-25263
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-25263
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: CDR/cdr_adaptive_odbc
    Affects Versions: SVN
         Environment: Slackware Linux
            Reporter: Elazar Broad
            Severity: Critical


The logic in the if statement which determines whether to use quoted statements in cdr_adaptive_odbc.c is reversed, resulting in a reference to tableptr->quoted_identifiers which is null, which terminates the sql buffer resulting in a truncated SQL statement[INSERT INTO table (]. 
--
  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);

                                }
--

should be

--
  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);

                                }
--



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list