Browse Source

Merge remote-tracking branch 'victorholt/master'

Lasse Öörni 9 years ago
parent
commit
9065247c45
1 changed files with 5 additions and 1 deletions
  1. 5 1
      Source/Urho3D/Database/SQLite/SQLiteConnection.cpp

+ 5 - 1
Source/Urho3D/Database/SQLite/SQLiteConnection.cpp

@@ -64,7 +64,11 @@ DbResult DbConnection::Execute(const String& sql, bool useCursorEvent)
     const char* zLeftover = 0;
     sqlite3_stmt* pStmt = 0;
     assert(connectionImpl_);
-    int rc = sqlite3_prepare_v2(connectionImpl_, sql.Trimmed().CString(), -1, &pStmt, &zLeftover);
+
+    // 2016-10-09: Prevent string corruption when trimmed is returned.
+    String trimmedSqlStr = sql.Trimmed();
+
+    int rc = sqlite3_prepare_v2(connectionImpl_, trimmedSqlStr.CString(), -1, &pStmt, &zLeftover);
     if (rc != SQLITE_OK)
     {
         URHO3D_LOGERRORF("Could not execute: %s", sqlite3_errmsg(connectionImpl_));