[asterisk-bugs] [Asterisk 0011364]: ESCAPE clause in first parameter not escaped properly

noreply at bugs.digium.com noreply at bugs.digium.com
Sat Nov 24 16:51:01 CST 2007


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=11364 
====================================================================== 
Reported By:                elguero
Assigned To:                Corydon76
====================================================================== 
Project:                    Asterisk
Issue ID:                   11364
Category:                   Resources/res_config_odbc
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     ready for testing
Asterisk Version:            SVN 
SVN Branch (only for SVN checkouts, not tarball releases):  trunk 
SVN Revision (number only!): 89535 
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             11-24-2007 09:58 CST
Last Modified:              11-24-2007 16:51 CST
====================================================================== 
Summary:                    ESCAPE clause in first parameter not escaped
properly
Description: 
Recent change to Trunk Revision 89535 causes queries sent to MySQL to fail
due to the ESCAPE clause not having the appropriate syntax when the ESCAPE
clause is used in the middle of a query statement.

Change line 292 to the following fixes it (at least for MySQL):

snprintf(sql, sizeof(sql), "SELECT * FROM %s WHERE %s%s ?%s", table,
newparam, op, strcasestr(newparam, "LIKE") ? " ESCAPE '\\\\'" : "");
====================================================================== 

---------------------------------------------------------------------- 
 elguero - 11-24-07 16:51  
---------------------------------------------------------------------- 
I had a feeling that MS SQL wouldn't like that.

The above patch works.  I did not try it with the 1.4 branch but rather
with trunk.

Thanks 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
11-24-07 16:51  elguero        Note Added: 0074275                          
======================================================================




More information about the asterisk-bugs mailing list