1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-16 23:02:26 +03:00

Do not allow indexing of any table whose name begins with "sqlite_".

Ticket #3284.  Improve handling of databases with malformed schemas -
just in case somebody has actually indexed a system table. (CVS 5553)

FossilOrigin-Name: 0e1d8d14a153483e65bd0246d23db2b823a122d1
This commit is contained in:
drh
2008-08-11 18:44:58 +00:00
parent ec0a0c8c35
commit c456e57af7
9 changed files with 50 additions and 32 deletions

View File

@@ -22,7 +22,7 @@
** COMMIT
** ROLLBACK
**
** $Id: build.c,v 1.494 2008/08/06 13:47:41 danielk1977 Exp $
** $Id: build.c,v 1.495 2008/08/11 18:44:58 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -2011,7 +2011,7 @@ void sqlite3DropTable(Parse *pParse, SrcList *pName, int isView, int noErr){
}
}
#endif
if( pTab->readOnly || pTab==db->aDb[iDb].pSchema->pSeqTab ){
if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0 ){
sqlite3ErrorMsg(pParse, "table %s may not be dropped", pTab->zName);
goto exit_drop_table;
}
@@ -2411,7 +2411,7 @@ void sqlite3CreateIndex(
pDb = &db->aDb[iDb];
if( pTab==0 || pParse->nErr ) goto exit_create_index;
if( pTab->readOnly ){
if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0 ){
sqlite3ErrorMsg(pParse, "table %s may not be indexed", pTab->zName);
goto exit_create_index;
}