]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Make sure filenames handed to the VFS by the fake_big_file test procedure
authordrh <drh@noemail.net>
Wed, 11 Jan 2012 00:38:51 +0000 (00:38 +0000)
committerdrh <drh@noemail.net>
Wed, 11 Jan 2012 00:38:51 +0000 (00:38 +0000)
are double-zero terminated.

FossilOrigin-Name: d0a868607e8f46941ece9f9d7b8ba220a7fb4e2b

manifest
manifest.uuid
src/test2.c

index da7428de0bd6e62c367fdee430f19a5c7f068f69..b479465252c180baefad9813cca6441d534f6308 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Only\srequire\sdouble-zero\sterminators\son\sdatabase\sfilenames,\snot\sany\severy\nfiles\ssupplied\sto\sthe\sxOpen\smethod.\s\sThis\sbacks\sout\s[2544f233f1].\s\sAlso\nrefactor\sthe\sfillInUnixFile()\sroutine\sin\sos_unix.c\sto\sreduce\sthe\snumber\nof\sparameters.
-D 2012-01-10T23:18:38.025
+C Make\ssure\sfilenames\shanded\sto\sthe\sVFS\sby\sthe\sfake_big_file\stest\sprocedure\nare\sdouble-zero\sterminated.
+D 2012-01-11T00:38:51.026
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 5b4a3e12a850b021547e43daf886b25133b44c07
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -190,7 +190,7 @@ F src/status.c 4568e72dfd36b6a5911f93457364deb072e0b03a
 F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
 F src/tclsqlite.c bd86070f52ae3f77a2e6b3b065ff03adb9140bfa
 F src/test1.c 1b1e514e85ffe7152b02cba38bd0a1ce8cd56113
-F src/test2.c 80d323d11e909cf0eb1b6fbb4ac22276483bcf31
+F src/test2.c 711555927f1f7e8db9aab86b512bc6934a774abe
 F src/test3.c 91d3f1a09cfae3533ef17d8b484a160f3d1f1a21
 F src/test4.c d1e5a5e904d4b444cf572391fdcb017638e36ff7
 F src/test5.c e1a19845625144caf038031234a12185e40d315c
@@ -986,7 +986,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
 F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a
 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
-P 722735a4f316630c907149f08d3d7dccc0facd9a af59b182d797642e5ec3ddf291cf62662a136bd1
-R 0517e1b31ad3aca42e254a546daa87b4
+P cb774b26e13745cfad0d76a71e47466d703e0007
+R 780bf2e97bf51fe59b326674e184191e
 U drh
-Z c7868cbe469d9c92bafb5dccf1093985
+Z 3db9953fe728ac89f28aade46f63b156
index 3bcb2f9c7ba9f37e08837dd3f6a0f24e4b07d723..a1133a352d61f6273791a5fd2f2399f11a5d1b6b 100644 (file)
@@ -1 +1 @@
-cb774b26e13745cfad0d76a71e47466d703e0007
\ No newline at end of file
+d0a868607e8f46941ece9f9d7b8ba220a7fb4e2b
\ No newline at end of file
index fa7dd76ce4a3620bc7f414633f03960174899128..8343692f6abf4072fbc6863b3cc0fa6142febdfb 100644 (file)
@@ -537,6 +537,8 @@ static int fake_big_file(
   int rc;
   int n;
   i64 offset;
+  char *zFile;
+  int nFile;
   if( argc!=3 ){
     Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
        " N-MEGABYTES FILE\"", 0);
@@ -545,17 +547,24 @@ static int fake_big_file(
   if( Tcl_GetInt(interp, argv[1], &n) ) return TCL_ERROR;
 
   pVfs = sqlite3_vfs_find(0);
-  rc = sqlite3OsOpenMalloc(pVfs, argv[2], &fd, 
+  nFile = strlen(argv[2]);
+  zFile = sqlite3_malloc( nFile+2 );
+  if( zFile==0 ) return TCL_ERROR;
+  memcpy(zFile, argv[2], nFile+1);
+  zFile[nFile+1] = 0;
+  rc = sqlite3OsOpenMalloc(pVfs, zFile, &fd, 
       (SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE|SQLITE_OPEN_MAIN_DB), 0
   );
   if( rc ){
     Tcl_AppendResult(interp, "open failed: ", errorName(rc), 0);
+    sqlite3_free(zFile);
     return TCL_ERROR;
   }
   offset = n;
   offset *= 1024*1024;
   rc = sqlite3OsWrite(fd, "Hello, World!", 14, offset);
   sqlite3OsCloseFree(fd);
+  sqlite3_free(zFile);
   if( rc ){
     Tcl_AppendResult(interp, "write failed: ", errorName(rc), 0);
     return TCL_ERROR;