Skip to content

Commit c7fed9e

Browse files
committed
Merge pull request neosmart#2 from fr00b0/master
Properly escape table names
2 parents b2651c2 + aae8c3d commit c7fed9e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

CppSQLite3.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,11 +1166,10 @@ CppSQLite3Statement CppSQLite3DB::compileStatement(const char* szSQL)
11661166

11671167
bool CppSQLite3DB::tableExists(const char* szTable)
11681168
{
1169-
char szSQL[128];
1170-
sprintf(szSQL,
1171-
"select count(*) from sqlite_master where type='table' and name='%s'",
1172-
szTable);
1173-
int nRet = execScalar(szSQL);
1169+
CppSQLite3Buffer sql;
1170+
sql.format( "select count(*) from sqlite_master where type='table' and name=%Q",
1171+
szTable );
1172+
int nRet = execScalar(sql);
11741173
return (nRet > 0);
11751174
}
11761175

0 commit comments

Comments
 (0)