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

Never use strlen(). Use our own internal sqlite3Strlen30() which is

guaranteed to never overflow an integer.  Additional explicit casts to
avoid nuisance warning messages. (CVS 6007)

FossilOrigin-Name: c872d554930ecf221ac2be5f886d5d67bb35288c
This commit is contained in:
drh
2008-12-10 19:26:22 +00:00
parent b27b7f5d3b
commit ea6788322e
35 changed files with 300 additions and 250 deletions

View File

@@ -11,7 +11,7 @@
*************************************************************************
** This file contains code used to implement the PRAGMA command.
**
** $Id: pragma.c,v 1.196 2008/12/10 17:20:01 drh Exp $
** $Id: pragma.c,v 1.197 2008/12/10 19:26:24 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -40,7 +40,7 @@ static int getSafetyLevel(const char *z){
if( isdigit(*z) ){
return atoi(z);
}
n = strlen(z);
n = sqlite3Strlen30(z);
for(i=0; i<ArraySize(iLength); i++){
if( iLength[i]==n && sqlite3StrNICmp(&zText[iOffset[i]],z,n)==0 ){
return iValue[i];
@@ -464,7 +464,7 @@ void sqlite3Pragma(
if( zRight==0 ){
eMode = PAGER_JOURNALMODE_QUERY;
}else{
int n = strlen(zRight);
int n = sqlite3Strlen30(zRight);
eMode = sizeof(azModeName)/sizeof(azModeName[0]) - 1;
while( eMode>=0 && sqlite3StrNICmp(zRight, azModeName[eMode], n)!=0 ){
eMode--;
@@ -1345,7 +1345,7 @@ void sqlite3Pragma(
#if SQLITE_HAS_CODEC
if( sqlite3StrICmp(zLeft, "key")==0 ){
sqlite3_key(db, zRight, strlen(zRight));
sqlite3_key(db, zRight, sqlite3Strlen30(zRight));
}else
#endif
#if SQLITE_HAS_CODEC || defined(SQLITE_ENABLE_CEROD)