X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/0e1db9d189370fed9f1993183ec38d748a8812f7..7e6b461318c8a779d91381531435a68ee4e8b6ed:/OSX/libsecurity_codesigning/lib/resources.cpp?ds=inline diff --git a/OSX/libsecurity_codesigning/lib/resources.cpp b/OSX/libsecurity_codesigning/lib/resources.cpp index 2c8a43ef..221e2984 100644 --- a/OSX/libsecurity_codesigning/lib/resources.cpp +++ b/OSX/libsecurity_codesigning/lib/resources.cpp @@ -138,10 +138,15 @@ static bool findStringEndingNoCase(const char *path, const char * end) void ResourceBuilder::scan(Scanner next) { bool first = true; - + while (FTSENT *ent = fts_read(mFTS)) { static const char ds_store[] = ".DS_Store"; - const char *relpath = ent->fts_path + mRoot.size() + 1; // skip prefix + "/" + const char *relpath = ent->fts_path + mRoot.size(); // skip prefix + + if (strlen(relpath) > 0) { + relpath += 1; // skip "/" + } + std::string rp; if (mRelBase != mRoot) { assert(mRelBase == mRoot + "/Contents"); @@ -183,7 +188,7 @@ void ResourceBuilder::scan(Scanner next) secinfo("rdirenum", "entering %s", ent->fts_path); GKBIS_Num_dirs++; - if (!first) { // skip root directory (relpath invalid) + if (!first) { // skip root directory if (Rule *rule = findRule(relpath)) { if (rule->flags & nested) { if (strchr(ent->fts_name, '.')) { // nested, has extension -> treat as nested bundle