mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-09 14:21:03 +03:00
Make sure filenames passed into sqlite3OsOpen() always have the extra
zero-terminators needed by sqlite3_uri_parameter(). FossilOrigin-Name: d73e93cfdc9441ade77b796dcdcf6eeb753cb398
This commit is contained in:
@@ -1164,6 +1164,10 @@ int sqlite3AbsInt32(int x){
|
||||
** If SQLITE_ENABLE_8_3_NAMES is set to 2 at compile-time, then always
|
||||
** do the suffix shortening regardless of URI parameter.
|
||||
**
|
||||
** Assume that zBaseFilename contains two \000 terminator bytes (so that
|
||||
** it can be harmlessly passed into sqlite3_uri_parameter()) and copy both
|
||||
** zero terminator bytes into the end of the revised name.
|
||||
**
|
||||
** Examples:
|
||||
**
|
||||
** test.db-journal => test.nal
|
||||
@@ -1172,6 +1176,7 @@ int sqlite3AbsInt32(int x){
|
||||
** test.db-mj7f3319fa => test.9fa
|
||||
*/
|
||||
void sqlite3FileSuffix3(const char *zBaseFilename, char *z){
|
||||
assert( zBaseFilename[strlen(zBaseFilename)+1]==0 );
|
||||
#if SQLITE_ENABLE_8_3_NAMES<2
|
||||
if( sqlite3_uri_boolean(zBaseFilename, "8_3_names", 0) )
|
||||
#endif
|
||||
@@ -1179,7 +1184,7 @@ void sqlite3FileSuffix3(const char *zBaseFilename, char *z){
|
||||
int i, sz;
|
||||
sz = sqlite3Strlen30(z);
|
||||
for(i=sz-1; i>0 && z[i]!='/' && z[i]!='.'; i--){}
|
||||
if( z[i]=='.' && ALWAYS(sz>i+4) ) memmove(&z[i+1], &z[sz-3], 4);
|
||||
if( z[i]=='.' && ALWAYS(sz>i+4) ) memmove(&z[i+1], &z[sz-3], 5);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user