1
0
Fork 0

fix underflow in copying code (#10264)

This commit is contained in:
Jan 2019-10-16 16:54:55 +02:00 committed by GitHub
parent cfce3d8df8
commit 87bac40abb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 23 deletions

View File

@ -513,7 +513,6 @@ void V8DealerFeature::copyInstallationFiles() {
// don't copy files in .bin // don't copy files in .bin
return true; return true;
} }
if (filename.size() >= nodeModulesPath.size()) {
std::string normalized = filename; std::string normalized = filename;
FileUtils::normalizePath(normalized); FileUtils::normalizePath(normalized);
if ((!nodeModulesPath.empty() && if ((!nodeModulesPath.empty() &&
@ -525,7 +524,6 @@ void V8DealerFeature::copyInstallationFiles() {
// filter it out! // filter it out!
return true; return true;
} }
}
// let the file/directory pass through // let the file/directory pass through
return false; return false;
}; };

View File

@ -288,18 +288,17 @@ void V8ShellFeature::copyInstallationFiles() {
return true; return true;
} }
if (filename.size() >= nodeModulesPath.size()) {
std::string normalized = filename; std::string normalized = filename;
FileUtils::normalizePath(normalized); FileUtils::normalizePath(normalized);
TRI_ASSERT(filename.size() == normalized.size()); if ((!nodeModulesPath.empty() &&
if (normalized.substr(normalized.size() - nodeModulesPath.size(), normalized.size() >= nodeModulesPath.size() &&
nodeModulesPath.size()) == nodeModulesPath || normalized.substr(normalized.size() - nodeModulesPath.size(), nodeModulesPath.size()) == nodeModulesPath) ||
normalized.substr(normalized.size() - nodeModulesPathVersioned.size(), (!nodeModulesPathVersioned.empty() &&
nodeModulesPathVersioned.size()) == nodeModulesPathVersioned) { normalized.size() >= nodeModulesPathVersioned.size() &&
normalized.substr(normalized.size() - nodeModulesPathVersioned.size(), nodeModulesPathVersioned.size()) == nodeModulesPathVersioned)) {
// filter it out! // filter it out!
return true; return true;
} }
}
// let the file/directory pass through // let the file/directory pass through
return false; return false;
}; };