Index: src/main.c ================================================================== --- src/main.c +++ src/main.c @@ -1824,10 +1824,11 @@ ){ int rc = SQLITE_OK; unsigned int flags = *pFlags; const char *zVfs = zDefaultVfs; char *zFile; + char c; int nUri = sqlite3Strlen30(zUri); assert( *pzErrMsg==0 ); if( ((flags & SQLITE_OPEN_URI) || sqlite3GlobalConfig.bOpenUri) @@ -1871,12 +1872,12 @@ ** 0: Parsing file-name. ** 1: Parsing name section of a name=value query parameter. ** 2: Parsing value section of a name=value query parameter. */ eState = 0; - while( zUri[iIn] && zUri[iIn]!='#' ){ - char c = zUri[iIn++]; + while( (c = zUri[iIn])!=0 && c!='#' ){ + iIn++; if( c=='%' && sqlite3Isxdigit(zUri[iIn]) && sqlite3Isxdigit(zUri[iIn+1]) ){ int octet = (sqlite3HexToInt(zUri[iIn++]) << 4); @@ -1886,14 +1887,14 @@ if( octet==0 ){ /* 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 ** and skip to the next "?", "=" or "&", as appropriate. */ - while( zUri[iIn] && zUri[iIn]!='#' - && (eState!=0 || zUri[iIn]!='?') - && (eState!=1 || (zUri[iIn]!='=' && zUri[iIn]!='&')) - && (eState!=2 || zUri[iIn]!='&') + while( (c = zUri[iIn])!=0 && c!='#' + && (eState!=0 || c!='?') + && (eState!=1 || (c!='=' && c!='&')) + && (eState!=2 || c!='&') ){ iIn++; } continue; } @@ -1981,10 +1982,12 @@ *pzErrMsg = sqlite3_mprintf("no such %s mode: %s", zModeType, zVal); rc = SQLITE_ERROR; goto parse_uri_out; } if( mode>limit ){ + *pzErrMsg = sqlite3_mprintf("%s mode not allowed: %s", + zModeType, zVal); rc = SQLITE_PERM; goto parse_uri_out; } flags = (flags & ~mask) | mode; }