mirror of
https://github.com/sqlite/sqlite.git
synced 2025-10-24 09:53:10 +03:00
Fix enforcement of the LIKE_PATTERN limit. (CVS 3962)
FossilOrigin-Name: 8819617b7cf7ccd64bf6bb4ba208f37126964ec2
This commit is contained in:
11
src/func.c
11
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user