/ Check-in [20dba3a7]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make sure the sqlite3_prepare16 and sqlite3_prepare16_v2 interfaces do not read past a zero-terminator if the nBytes parameter is too large.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 20dba3a7fb3e7078b95af3beca948467a3af6a89
User & Date: drh 2013-07-16 23:26:43
Context
2013-07-17
11:54
Clear the error string pointer in sqlite3_vtab object after the error string is transferred to SQLite. Ticket [78588b938a11]. check-in: 64bf8148 user: drh tags: trunk
2013-07-16
23:26
Make sure the sqlite3_prepare16 and sqlite3_prepare16_v2 interfaces do not read past a zero-terminator if the nBytes parameter is too large. check-in: 20dba3a7 user: drh tags: trunk
21:31
Enhance the query planner so that it looks at multiple solutions to OR expressions in the WHERE clause. check-in: 5e19d054 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/prepare.c.

805
806
807
808
809
810
811






812
813
814
815
816
817
818
  const char *zTail8 = 0;
  int rc = SQLITE_OK;

  assert( ppStmt );
  *ppStmt = 0;
  if( !sqlite3SafetyCheckOk(db) ){
    return SQLITE_MISUSE_BKPT;






  }
  sqlite3_mutex_enter(db->mutex);
  zSql8 = sqlite3Utf16to8(db, zSql, nBytes, SQLITE_UTF16NATIVE);
  if( zSql8 ){
    rc = sqlite3LockAndPrepare(db, zSql8, -1, saveSqlFlag, 0, ppStmt, &zTail8);
  }








>
>
>
>
>
>







805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
  const char *zTail8 = 0;
  int rc = SQLITE_OK;

  assert( ppStmt );
  *ppStmt = 0;
  if( !sqlite3SafetyCheckOk(db) ){
    return SQLITE_MISUSE_BKPT;
  }
  if( nBytes>=0 ){
    int sz;
    const char *z = (const char*)zSql;
    for(sz=0; sz<nBytes && (z[sz]!=0 || z[sz+1]!=0); sz += 2){}
    nBytes = sz;
  }
  sqlite3_mutex_enter(db->mutex);
  zSql8 = sqlite3Utf16to8(db, zSql, nBytes, SQLITE_UTF16NATIVE);
  if( zSql8 ){
    rc = sqlite3LockAndPrepare(db, zSql8, -1, saveSqlFlag, 0, ppStmt, &zTail8);
  }