From 6020e8a4c3e91d9725e015c4de6bfa05bf982594 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Mon, 1 Dec 2008 14:08:53 +0000 Subject: [PATCH] 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 --- src/kits/storage/Directory.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/kits/storage/Directory.cpp b/src/kits/storage/Directory.cpp index cc323d1cc9..c8a96bf325 100644 --- a/src/kits/storage/Directory.cpp +++ b/src/kits/storage/Directory.cpp @@ -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; }