When comparing paths, we need to ensure that the entry's path does in fact have a path separator at the same position as the original, otherwise we incorrectly indicate containment in some cases. Fixes ticket #3186.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28754 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -508,7 +508,13 @@ BDirectory::Contains(const BEntry *entry, int32 nodeFlags) const
|
||||
if (dirPath.InitCheck() != B_OK || entryPath.InitCheck() != B_OK)
|
||||
return false;
|
||||
|
||||
return !strncmp(dirPath.Path(), entryPath.Path(), strlen(dirPath.Path()));
|
||||
uint32 dirLen = strlen(dirPath.Path());
|
||||
|
||||
if (!strncmp(dirPath.Path(), entryPath.Path(), dirLen)) {
|
||||
if (strlen(entryPath.Path()) > dirLen && entryPath.Path()[dirLen] == '/')
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user