diff options
author | drh <drh@noemail.net> | 2009-04-02 09:07:12 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2009-04-02 09:07:12 +0000 |
commit | ef31c6aa9792eed22b52e574229b09f965d90677 (patch) | |
tree | e5076bb38702acc769319b374ecb144c5ed6703e /src | |
parent | 64f798dddc6d55ebe17b5a251e9b80cdaac1a851 (diff) | |
download | sqlite-ef31c6aa9792eed22b52e574229b09f965d90677.tar.gz sqlite-ef31c6aa9792eed22b52e574229b09f965d90677.zip |
Enforce the run-time sqlite3_limit() length limit on zeroblob(), not just
the compile-time SQLITE_MAX_LENGTH limit. (CVS 6433)
FossilOrigin-Name: a04f9e7959325da18f66a1aa4ead1c50993807cb
Diffstat (limited to 'src')
-rw-r--r-- | src/func.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/func.c b/src/func.c index 85ec68b73..baedf178b 100644 --- a/src/func.c +++ b/src/func.c @@ -16,7 +16,7 @@ ** sqliteRegisterBuildinFunctions() found at the bottom of the file. ** All other code has file scope. ** -** $Id: func.c,v 1.226 2009/04/01 16:33:38 drh Exp $ +** $Id: func.c,v 1.227 2009/04/02 09:07:13 drh Exp $ */ #include "sqliteInt.h" #include <stdlib.h> @@ -270,12 +270,13 @@ static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ */ static void *contextMalloc(sqlite3_context *context, i64 nByte){ char *z; + assert( nByte>0 ); if( nByte>sqlite3_context_db_handle(context)->aLimit[SQLITE_LIMIT_LENGTH] ){ sqlite3_result_error_toobig(context); z = 0; }else{ z = sqlite3Malloc((int)nByte); - if( !z && nByte>0 ){ + if( !z ){ sqlite3_result_error_nomem(context); } } @@ -811,7 +812,7 @@ static void zeroblobFunc( assert( argc==1 ); UNUSED_PARAMETER(argc); n = sqlite3_value_int64(argv[0]); - if( n>SQLITE_MAX_LENGTH ){ + if( n>sqlite3_context_db_handle(context)->aLimit[SQLITE_LIMIT_LENGTH] ){ sqlite3_result_error_toobig(context); }else{ sqlite3_result_zeroblob(context, (int)n); |