Ticket #3129 (closed Bugs: fixed)

Opened 3 months ago

Last modified 3 months ago

SQLITE3 incorrect use of '_' without ESCAPE causes trunks to crash

Reported by: p_lindheimer Assigned to: ethans
Priority: blocker Milestone: 2.5
Component: Sqlite3 Version: 2.5-branch
Keywords: core Cc:
Confirmation: Confirmed SVN Revision (if applicable):
Backend Engine: All Backend Engine Version:

Description

core_trunks_list() is one function where this manifests itself as soon as you start having multiple trunks in sqlite3. The issue is that sqlite3 treats "_" as a wildcard and has a special syntax to create an escape character. The following two queries are problematic but all of the code base needs to be searched as there are others:

$sqlstr = "SELECT variable, value FROM globals WHERE variable LIKE 'OUT_%'";
$my_unique_trunks = sql($sqlstr,"getAll",DB_FETCHMODE_ASSOC);
                          
$sqlstr = "SELECT variable, value FROM globals WHERE variable LIKE 'OUTDISABLE_%'";
$disable_states = sql($sqlstr,"getAll",DB_FETCHMODE_ASSOC);

and the following syntax fixed them:

$sqlstr = "SELECT variable, value FROM globals WHERE variable LIKE 'OUT\_%' ESCAPE '\'";
$my_unique_trunks = sql($sqlstr,"getAll",DB_FETCHMODE_ASSOC);
                          
$sqlstr = "SELECT variable, value FROM globals WHERE variable LIKE 'OUTDISABLE\_%' ESCAPE '\'";
$disable_states = sql($sqlstr,"getAll",DB_FETCHMODE_ASSOC);

Change History

09/01/08 13:01:22 changed by ethans

  • status changed from new to closed.
  • resolution set to fixed.

(In [6531]) Fixes #3129. Tested on sqlite3, syntax ok.

09/01/08 13:51:08 changed by p_lindheimer

  • status changed from closed to reopened.
  • resolution deleted.

ethans, those were just a couple of examples. There are several other places in the code that have '_' as part of select and will require an "if ($sqlite3) type syntax. So re-opening until those get changed.

09/01/08 15:43:37 changed by ethans

  • status changed from reopened to closed.
  • resolution set to fixed.

(In [6534]) I think I got all the instances of LIKE _'s that need to be escaped properly in sqlite3

Fixes #3129

Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads