diff options
author | danielk1977 <danielk1977@noemail.net> | 2007-05-09 08:24:44 +0000 |
---|---|---|
committer | danielk1977 <danielk1977@noemail.net> | 2007-05-09 08:24:44 +0000 |
commit | b56fe1ff27e97c0f6d8e8c7552be8c73e2862df4 (patch) | |
tree | b6ed9cf54476620c96ea79ab56db79f947288476 /src/func.c | |
parent | 37cd66a6a02f74939585414a3dace0195e5e41ef (diff) | |
download | sqlite-b56fe1ff27e97c0f6d8e8c7552be8c73e2862df4.tar.gz sqlite-b56fe1ff27e97c0f6d8e8c7552be8c73e2862df4.zip |
Fix enforcement of the LIKE_PATTERN limit. (CVS 3962)
FossilOrigin-Name: 8819617b7cf7ccd64bf6bb4ba208f37126964ec2
Diffstat (limited to 'src/func.c')
-rw-r--r-- | src/func.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/func.c b/src/func.c index c9a035a42..a8fbe104e 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.152 2007/05/08 20:37:39 drh Exp $ +** $Id: func.c,v 1.153 2007/05/09 08:24:44 danielk1977 Exp $ */ #include "sqliteInt.h" #include <ctype.h> @@ -540,14 +540,13 @@ static void likeFunc( /* Limit the length of the LIKE or GLOB pattern to avoid problems ** of deep recursion and N*N behavior in patternCompare(). */ - if( sqlite3_value_bytes(argv[1])>SQLITE_MAX_LIKE_PATTERN_LENGTH ){ + if( sqlite3_value_bytes(argv[0])>SQLITE_MAX_LIKE_PATTERN_LENGTH ){ sqlite3_result_error(context, "LIKE or GLOB pattern too complex", -1); return; } - - zA = sqlite3_value_text(argv[0]); - zB = sqlite3_value_text(argv[1]); + zB = sqlite3_value_text(argv[0]); + zA = sqlite3_value_text(argv[1]); int escape = 0; if( argc==3 ){ /* The escape character string must consist of a single UTF-8 character. @@ -568,7 +567,7 @@ static void likeFunc( sqlite3_like_count++; #endif - sqlite3_result_int(context, patternCompare(zA, zB, pInfo, escape)); + sqlite3_result_int(context, patternCompare(zB, zA, pInfo, escape)); } } |