diff options
author | drh <drh@noemail.net> | 2014-10-24 00:35:58 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2014-10-24 00:35:58 +0000 |
commit | 9ca95730e3a25bf5b335ec73a0a14f0112a421fb (patch) | |
tree | 3d17fb8a23416f52cd800470fb9509d646fe2800 /src/backup.c | |
parent | 4f81bbb5289cdd248c21775b9e4cdb92e110e139 (diff) | |
download | sqlite-9ca95730e3a25bf5b335ec73a0a14f0112a421fb.tar.gz sqlite-9ca95730e3a25bf5b335ec73a0a14f0112a421fb.zip |
Add the SQLITE_ENABLE_API_ARMOR compile-time option. This is a work in
progress and is not yet completely functional.
FossilOrigin-Name: c297a84bc678f81ffc0aa9139ab73f0ca87c1971
Diffstat (limited to 'src/backup.c')
-rw-r--r-- | src/backup.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/backup.c b/src/backup.c index 92c6334bd..da4303e5f 100644 --- a/src/backup.c +++ b/src/backup.c @@ -138,6 +138,13 @@ sqlite3_backup *sqlite3_backup_init( ){ sqlite3_backup *p; /* Value to return */ +#ifdef SQLITE_ENABLE_API_ARMOR + if( !sqlite3SafetyCheckOk(pSrcDb)||!sqlite3SafetyCheckOk(pDestDb) ){ + (void)SQLITE_MISUSE_BKPT; + return 0; + } +#endif + /* Lock the source database handle. The destination database ** handle is not locked in this routine, but it is locked in ** sqlite3_backup_step(). The user is required to ensure that no @@ -334,6 +341,9 @@ int sqlite3_backup_step(sqlite3_backup *p, int nPage){ int pgszSrc = 0; /* Source page size */ int pgszDest = 0; /* Destination page size */ +#ifdef SQLITE_ENABLE_API_ARMOR + if( p==0 ) return SQLITE_MISUSE_BKPT; +#endif sqlite3_mutex_enter(p->pSrcDb->mutex); sqlite3BtreeEnter(p->pSrc); if( p->pDestDb ){ @@ -623,6 +633,12 @@ int sqlite3_backup_finish(sqlite3_backup *p){ ** call to sqlite3_backup_step(). */ int sqlite3_backup_remaining(sqlite3_backup *p){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( p==0 ){ + (void)SQLITE_MISUSE_BKPT; + return 0; + } +#endif return p->nRemaining; } @@ -631,6 +647,12 @@ int sqlite3_backup_remaining(sqlite3_backup *p){ ** recent call to sqlite3_backup_step(). */ int sqlite3_backup_pagecount(sqlite3_backup *p){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( p==0 ){ + (void)SQLITE_MISUSE_BKPT; + return 0; + } +#endif return p->nPagecount; } |