Utility::MkDirP(path, 0700);
WriteStageConfig(moduleName, stageName);
+ bool foundDotDot = false;
ObjectLock olock(files);
BOOST_FOREACH(const Dictionary::Pair& kv, files) {
- if (ContainsDotDot(kv.first))
- BOOST_THROW_EXCEPTION(std::invalid_argument("Path must not contain '..'."));
+ if (ContainsDotDot(kv.first)) {
+ foundDotDot = true;
+ break;
+ }
String filePath = path + "/" + kv.first;
fp.close();
}
+ if (foundDotDot) {
+ Utility::RemoveDirRecursive(path);
+ BOOST_THROW_EXCEPTION(std::invalid_argument("Path must not contain '..'."));
+ }
+
return stageName;
}