]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Return a suitable error message if the mode= argument to a URI specifies
authordrh <drh@noemail.net>
Mon, 9 May 2011 19:20:17 +0000 (19:20 +0000)
committerdrh <drh@noemail.net>
Mon, 9 May 2011 19:20:17 +0000 (19:20 +0000)
a higher mode than what is allowed by context.  Other minor cleanups for
the URI parsing logic.

FossilOrigin-Name: d9bc1c7fe0ca5f6973a85827330958f4d09f8171

manifest
manifest.uuid
src/main.c

index 27e92dc7ff7c558fa98546ec1cf235792ddecfb5..daee9754e7ca84bf66336f646b976d8988f62c36 100644 (file)
--- 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
index 60e4538975e9f8a099a4e09ab788ba393ec2281e..2b8787f1e24fc482e0434e47db04d1c225b3d0c5 100644 (file)
@@ -1 +1 @@
-ca3797d4967361e31a8a5ce1ce8190b095f3ed4c
\ No newline at end of file
+d9bc1c7fe0ca5f6973a85827330958f4d09f8171
\ No newline at end of file
index 6fdffcd876297c8fb36a97a3cdc3a3df5bf4997c..5b46f4b7369df01b67d468d05fc8345b2ab2820e 100644 (file)
@@ -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;
           }