File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -645,12 +645,21 @@ materialize_generated_files(const std::filesystem::path& root,
645645 return std::unexpected (std::format (
646646 " generated_files path '{}' must be relative" , relPath.generic_string ()));
647647 }
648- for (auto const & part : relPath) {
648+ auto const genericPath = relPath.generic_string ();
649+ for (std::size_t begin = 0 ; begin <= genericPath.size ();) {
650+ auto const end = genericPath.find (' /' , begin);
651+ auto const part = genericPath.substr (begin, end == std::string::npos
652+ ? std::string::npos
653+ : end - begin);
649654 if (part == " .." ) {
650655 return std::unexpected (std::format (
651656 " generated_files path '{}' must not escape the package root" ,
652657 relPath.generic_string ()));
653658 }
659+ if (end == std::string::npos) {
660+ break ;
661+ }
662+ begin = end + 1 ;
654663 }
655664
656665 auto out = root / relPath.lexically_normal ();
You can’t perform that action at this time.
0 commit comments