1
0
Fork 0

fix path length checks when copying js files (#9191)

This commit is contained in:
Jan 2019-06-05 10:39:52 +02:00 committed by GitHub
parent 1d2071420b
commit e0c94e64d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -504,11 +504,12 @@ void V8DealerFeature::copyInstallationFiles() {
if (filename.size() >= nodeModulesPath.size()) {
std::string normalized = filename;
FileUtils::normalizePath(normalized);
TRI_ASSERT(filename.size() == normalized.size());
if (normalized.substr(normalized.size() - nodeModulesPath.size(),
nodeModulesPath.size()) == nodeModulesPath ||
normalized.substr(normalized.size() - nodeModulesPathVersioned.size(),
nodeModulesPathVersioned.size()) == nodeModulesPathVersioned) {
if ((!nodeModulesPath.empty() &&
normalized.size() >= nodeModulesPath.size() &&
normalized.substr(normalized.size() - nodeModulesPath.size(), nodeModulesPath.size()) == nodeModulesPath) ||
(!nodeModulesPathVersioned.empty() &&
normalized.size() >= nodeModulesPathVersioned.size() &&
normalized.substr(normalized.size() - nodeModulesPathVersioned.size(), nodeModulesPathVersioned.size()) == nodeModulesPathVersioned)) {
// filter it out!
return true;
}