From: drh Date: Mon, 9 May 2011 19:20:17 +0000 (+0000) Subject: Return a suitable error message if the mode= argument to a URI specifies X-Git-Tag: version-3.7.7~125 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=de941c3756aeafd202276c5f8028958717c0b5e4;p=thirdparty%2Fsqlite.git Return a suitable error message if the mode= argument to a URI specifies a higher mode than what is allowed by context. Other minor cleanups for the URI parsing logic. FossilOrigin-Name: d9bc1c7fe0ca5f6973a85827330958f4d09f8171 --- diff --git a/manifest b/manifest index 27e92dc7ff..daee9754e7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Set\sthe\ssqlite3.mallocFailed\sflag\sif\ssqlite3ParseUri\sfails\swith\sSQLITE_NOMEM. -D 2011-05-07T18:40:36.334 +C Return\sa\ssuitable\serror\smessage\sif\sthe\smode=\sargument\sto\sa\sURI\sspecifies\na\shigher\smode\sthan\swhat\sis\sallowed\sby\scontext.\s\sOther\sminor\scleanups\sfor\nthe\sURI\sparsing\slogic. +D 2011-05-09T19:20:17.775 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 7a4d9524721d40ef9ee26f93f9bd6a51dba106f2 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -144,7 +144,7 @@ F src/journal.c 552839e54d1bf76fb8f7abe51868b66acacf6a0e F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f F src/lempar.c 7f026423f4d71d989e719a743f98a1cbd4e6d99e F src/loadext.c 3ae0d52da013a6326310655be6473fd472347b85 -F src/main.c c914afd2c37b7662acb5034c20465b807037b84c +F src/main.c f00cee5a27f5df5ed536e7043cb451b3c85ce65c F src/malloc.c 591aedb20ae40813f1045f2ef253438a334775d9 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c 00bd8265c81abb665c48fea1e0c234eb3b922206 @@ -935,7 +935,7 @@ F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/split-sqlite3c.tcl d9be87f1c340285a3e081eb19b4a247981ed290c F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 3c926ce0976e765b4c51fcd81d251268ff21a741 -R 469c4635a93084885b543f0cd5b2c5df +P ca3797d4967361e31a8a5ce1ce8190b095f3ed4c +R fbfaa47316ae48b91e92f26cbe2f2742 U drh -Z c02f1d6b5c75b5c7abb8e8e853d0d67b +Z 82e3dc394cc5052bfb9a5a6a21e4f298 diff --git a/manifest.uuid b/manifest.uuid index 60e4538975..2b8787f1e2 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ca3797d4967361e31a8a5ce1ce8190b095f3ed4c \ No newline at end of file +d9bc1c7fe0ca5f6973a85827330958f4d09f8171 \ No newline at end of file diff --git a/src/main.c b/src/main.c index 6fdffcd876..5b46f4b736 100644 --- a/src/main.c +++ b/src/main.c @@ -1826,6 +1826,7 @@ int sqlite3ParseUri( unsigned int flags = *pFlags; const char *zVfs = zDefaultVfs; char *zFile; + char c; int nUri = sqlite3Strlen30(zUri); assert( *pzErrMsg==0 ); @@ -1873,8 +1874,8 @@ int sqlite3ParseUri( ** 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]) @@ -1888,10 +1889,10 @@ int sqlite3ParseUri( ** 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++; } @@ -1983,6 +1984,8 @@ int sqlite3ParseUri( goto parse_uri_out; } if( mode>limit ){ + *pzErrMsg = sqlite3_mprintf("%s mode not allowed: %s", + zModeType, zVal); rc = SQLITE_PERM; goto parse_uri_out; }