]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Use the specified buffer length, not the maximum buffer length in
authordrh <drh@noemail.net>
Thu, 6 Dec 2007 13:26:20 +0000 (13:26 +0000)
committerdrh <drh@noemail.net>
Thu, 6 Dec 2007 13:26:20 +0000 (13:26 +0000)
unixFullPathname() and related functions. (CVS 4595)

FossilOrigin-Name: f015a38771d98996366d66787b9b066f9ef5e248

manifest
manifest.uuid
src/os_unix.c
src/os_win.c

index 096e086db07995e37b0c4fc828e32980ec37a398..7f368115560de9db213b41fa78079794c802092a 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Continuing\swork\son\sthe\sC/C++\sinterface\srequirements\sthat\sappears\sas\ncomments\sin\ssqlite.h.in.\s(CVS\s4594)
-D 2007-12-06T02:42:08
+C Use\sthe\sspecified\sbuffer\slength,\snot\sthe\smaximum\sbuffer\slength\sin\nunixFullPathname()\sand\srelated\sfunctions.\s(CVS\s4595)
+D 2007-12-06T13:26:21
 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
 F Makefile.in 30789bf70614bad659351660d76b8e533f3340e9
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -120,9 +120,9 @@ F src/os_os2.c 98f5486f033a98406ac10619b2dde21aac9ff75e
 F src/os_os2.h c3f7d0af7e3453d1d7aa81b06c0a56f5a226530b
 F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c
 F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3
-F src/os_unix.c db6755454c84004d0041eb1b2194c90b35db0a5b
+F src/os_unix.c 10641ed959b960915deaf2d053105e1ee9849d88
 F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
-F src/os_win.c 1fb40eb62fb0719ea578d69edcb1a2974f04d214
+F src/os_win.c a92769a7ec45ff908ca5e83553c8582215bb58c5
 F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
 F src/pager.c 65298fee4e815c269fb374d3fe3cd1cf4f05ad94
 F src/pager.h f504f7ae84060fee0416a853e368d3d113c3d6fa
@@ -597,7 +597,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P ae1936aadf00bec91750d41be7507cf1b81fc411
-R 7ac7d80a2d75b3b7bb12edb35b1b87a6
+P 2130e7125187ca46df3f65237f933b0e568a36ed
+R 46d58c2b825acbbc2f0f22d13d04f251
 U drh
-Z ee325aa2259ef8ee38a408857daf2088
+Z 23c4660610c4748ff4d4c40cb59d832a
index d379b71530c61e74d2d8b51cc6bd68284acf7de9..213c083150d0c1c75eea68203da2d62ee828d8c1 100644 (file)
@@ -1 +1 @@
-2130e7125187ca46df3f65237f933b0e568a36ed
\ No newline at end of file
+f015a38771d98996366d66787b9b066f9ef5e248
\ No newline at end of file
index cd6a074a8605c8673666a7c43e4398e2bf4b8818..29a1933b34f1f2aba6c2b3ecd04248dcfbe8ad2d 100644 (file)
@@ -2512,10 +2512,12 @@ static int unixGetTempname(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
     zDir = azDirs[i];
     break;
   }
+  if( strlen(zDir) - sizeof(SQLITE_TEMP_FILE_PREFIX) - 17 <=0 ){
+    return SQLITE_ERROR;
+  }
   do{
     assert( pVfs->mxPathname==MAX_PATHNAME );
-    assert( nBuf>=MAX_PATHNAME );
-    sqlite3_snprintf(MAX_PATHNAME-17, zBuf, "%s/"SQLITE_TEMP_FILE_PREFIX, zDir);
+    sqlite3_snprintf(nBuf-17, zBuf, "%s/"SQLITE_TEMP_FILE_PREFIX, zDir);
     j = strlen(zBuf);
     sqlite3Randomness(15, &zBuf[j]);
     for(i=0; i<15; i++, j++){
@@ -2551,16 +2553,16 @@ static int unixFullPathname(
   SimulateIOError( return SQLITE_ERROR );
 
   assert( pVfs->mxPathname==MAX_PATHNAME );
-  zOut[MAX_PATHNAME-1] = '\0';
+  zOut[nOut-1] = '\0';
   if( zPath[0]=='/' ){
-    sqlite3_snprintf(MAX_PATHNAME, zOut, "%s", zPath);
+    sqlite3_snprintf(nOut, zOut, "%s", zPath);
   }else{
     int nCwd;
-    if( getcwd(zOut, MAX_PATHNAME-1)==0 ){
+    if( getcwd(zOut, nOut-1)==0 ){
       return SQLITE_CANTOPEN;
     }
     nCwd = strlen(zOut);
-    sqlite3_snprintf(MAX_PATHNAME-nCwd, &zOut[nCwd], "/%s", zPath);
+    sqlite3_snprintf(nOut-nCwd, &zOut[nCwd], "/%s", zPath);
   }
   return SQLITE_OK;
 
index 5bc370e0a6070eb7af300b305b84a310e80a6152..33ab77a856a3a85f81d65b23006bacfc29163a0f 100644 (file)
@@ -1304,7 +1304,7 @@ static int winGetTempname(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
   }
   for(i=strlen(zTempPath); i>0 && zTempPath[i-1]=='\\'; i--){}
   zTempPath[i] = 0;
-  sqlite3_snprintf(pVfs->mxPathname-30, zBuf,
+  sqlite3_snprintf(nBuf-30, zBuf,
                    "%s\\"SQLITE_TEMP_FILE_PREFIX, zTempPath);
   j = strlen(zBuf);
   sqlite3Randomness(20, &zBuf[j]);