aboutsummaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
authordrh <>2021-03-18 13:55:25 +0000
committerdrh <>2021-03-18 13:55:25 +0000
commit8e7c82ca3f07d44f8c504ea51d2002814b73b92d (patch)
treec14b8d502c335586d0ba70869ecfe70548f961a6 /src/os_unix.c
parente44ac3858c2d2a7b74bcd554697f93ffc9127c38 (diff)
downloadsqlite-8e7c82ca3f07d44f8c504ea51d2002814b73b92d.tar.gz
sqlite-8e7c82ca3f07d44f8c504ea51d2002814b73b92d.zip
Fix a problem with the filename normalizer in unix, discovered by dbsqlfuzz.
FossilOrigin-Name: ff1eca7fcdcbc550a5f23db9d85281e5373500912699a7c7ae54bc0df0547e26
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index a688ed270..e3cfe35cd 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -6361,7 +6361,8 @@ static int unixBackupDir(const char *z, int *pJ){
int j = *pJ;
int i;
if( j<=0 ) return 0;
- for(i=j-1; ALWAYS(i>0) && z[i-1]!='/'; i--){}
+ for(i=j-1; i>0 && z[i-1]!='/'; i--){}
+ if( i==0 ) return 0;
if( z[i]=='.' && i==j-2 && z[i+1]=='.' ) return 0;
*pJ = i-1;
return 1;