1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Enhance SQLITE_ALLOW_URI_AUTHORITITY to elide //localhost/ and to deal

with dodgy URIs that contain too many "/" characters.

FossilOrigin-Name: 39b566a2d0916c57f3fac756c6d6af149b44781d
This commit is contained in:
drh
2015-03-03 16:58:56 +00:00
parent 3ba689d8ba
commit 4a4b138965
3 changed files with 20 additions and 8 deletions

View File

@@ -2423,7 +2423,19 @@ int sqlite3ParseUri(
if( !zFile ) return SQLITE_NOMEM;
iIn = 5;
#ifndef SQLITE_ALLOW_URI_AUTHORITY
#ifdef SQLITE_ALLOW_URI_AUTHORITY
if( strncmp(zUri+5, "///", 3)==0 ){
iIn = 7;
/* The following condition causes URIs with five leading / characters
** like file://///host/path to be converted into UNCs like //host/path.
** The correct URI for that UNC has only two or four leading / characters
** file://host/path or file:////host/path. But 5 leading slashes is a
** common error, we are told, so we handle it as a special case. */
if( strncmp(zUri+7, "///", 3)==0 ){ iIn++; }
}else if( strncmp(zUri+5, "//localhost/", 12)==0 ){
iIn = 16;
}
#else
/* Discard the scheme and authority segments of the URI. */
if( zUri[5]=='/' && zUri[6]=='/' ){
iIn = 7;