1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-18 10:21:03 +03:00

Add more code to enforce the limits specified in limits.h. (CVS 3946)

FossilOrigin-Name: c59d436095b5258d7132a432c0cb6cd5a7990d85
This commit is contained in:
drh
2007-05-08 13:58:26 +00:00
parent 4b5710e486
commit e5c941b83b
8 changed files with 51 additions and 25 deletions

View File

@@ -13,7 +13,7 @@
** interface, and routines that contribute to loading the database schema
** from disk.
**
** $Id: prepare.c,v 1.48 2007/05/08 01:08:49 drh Exp $
** $Id: prepare.c,v 1.49 2007/05/08 13:58:28 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -490,7 +490,11 @@ int sqlite3Prepare(
memset(&sParse, 0, sizeof(sParse));
sParse.db = db;
if( nBytes>=0 && zSql[nBytes]!=0 ){
char *zSqlCopy = sqlite3StrNDup(zSql, nBytes);
char *zSqlCopy;
if( nBytes>SQLITE_MAX_SQL_LENGTH ){
return SQLITE_TOOBIG;
}
zSqlCopy = sqlite3StrNDup(zSql, nBytes);
if( zSqlCopy ){
sqlite3RunParser(&sParse, zSqlCopy, &zErrMsg);
sqliteFree(zSqlCopy);