mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-15 11:41:13 +03:00
Add compile time option SQLITE_ENABLE_URI_00_ERROR. If defined, any "%00"
escape found in a URI is treated as an error. FossilOrigin-Name: e8a9bfece27e2af178a206ad6bce3f24d64e7ee4
This commit is contained in:
@@ -155,6 +155,9 @@ static const char * const azCompileOpt[] = {
|
||||
#if SQLITE_ENABLE_UPDATE_DELETE_LIMIT
|
||||
"ENABLE_UPDATE_DELETE_LIMIT",
|
||||
#endif
|
||||
#if defined(SQLITE_ENABLE_URI_00_ERROR)
|
||||
"ENABLE_URI_00_ERROR",
|
||||
#endif
|
||||
#if SQLITE_HAS_CODEC
|
||||
"HAS_CODEC",
|
||||
#endif
|
||||
|
||||
@@ -2615,6 +2615,7 @@ int sqlite3ParseUri(
|
||||
|
||||
assert( octet>=0 && octet<256 );
|
||||
if( octet==0 ){
|
||||
#ifndef SQLITE_ENABLE_URI_00_ERROR
|
||||
/* This branch is taken when "%00" appears within the URI. In this
|
||||
** case we ignore all text in the remainder of the path, name or
|
||||
** value currently being parsed. So ignore the current character
|
||||
@@ -2627,6 +2628,12 @@ int sqlite3ParseUri(
|
||||
iIn++;
|
||||
}
|
||||
continue;
|
||||
#else
|
||||
/* If ENABLE_URI_00_ERROR is defined, "%00" in a URI is an error. */
|
||||
*pzErrMsg = sqlite3_mprintf("unexpected %%00 in uri");
|
||||
rc = SQLITE_ERROR;
|
||||
goto parse_uri_out;
|
||||
#endif
|
||||
}
|
||||
c = octet;
|
||||
}else if( eState==1 && (c=='&' || c=='=') ){
|
||||
|
||||
@@ -714,6 +714,12 @@ Tcl_SetVar2(interp, "sqlite_options", "mergesort", "1", TCL_GLOBAL_ONLY);
|
||||
Tcl_SetVar2(interp, "sqlite_options", "sqllog", "0", TCL_GLOBAL_ONLY);
|
||||
#endif
|
||||
|
||||
#ifdef SQLITE_ENABLE_URI_00_ERROR
|
||||
Tcl_SetVar2(interp, "sqlite_options", "uri_00_error", "1", TCL_GLOBAL_ONLY);
|
||||
#else
|
||||
Tcl_SetVar2(interp, "sqlite_options", "uri_00_error", "0", TCL_GLOBAL_ONLY);
|
||||
#endif
|
||||
|
||||
#define LINKVAR(x) { \
|
||||
static const int cv_ ## x = SQLITE_ ## x; \
|
||||
Tcl_LinkVar(interp, "SQLITE_" #x, (char *)&(cv_ ## x), \
|
||||
|
||||
Reference in New Issue
Block a user