diff --git a/modules/sqlite/sqlitepp/SqliteDatabase.cpp b/modules/sqlite/sqlitepp/SqliteDatabase.cpp index b926e98e..6258c8b6 100644 --- a/modules/sqlite/sqlitepp/SqliteDatabase.cpp +++ b/modules/sqlite/sqlitepp/SqliteDatabase.cpp @@ -81,6 +81,14 @@ IQuery *SqliteDatabase::PrepareQueryFmt(const char *fmt, ...) int SqliteDatabase::QuoteString(const char *str, char buffer[], size_t maxlen, size_t *newsize) { + auto size = strlen(str); + auto needed = size * 2 + 1; + + if (maxlen < needed) + { + return static_cast(needed); + } + char *res = sqlite3_snprintf(static_cast(maxlen), buffer, "%q", str); if (res != NULL && newsize != NULL)