Skip to content

Commit

Permalink
Fix possible fs::create_path recursion overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
elad335 authored and Nekotekina committed Oct 22, 2021
1 parent 8b4f3fa commit 9afa960
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Utilities/File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -683,9 +683,9 @@ bool fs::create_path(const std::string& path)

#ifdef _WIN32
// Workaround: don't call is_dir with naked drive letter
if (!parent.empty() && parent.back() != ':' && !is_dir(parent) && !create_path(parent))
if (parent.size() < path.size() && parent.back() != ':' && !is_dir(parent) && !create_path(parent))
#else
if (!parent.empty() && !is_dir(parent) && !create_path(parent))
if (parent.size() < path.size() && !is_dir(parent) && !create_path(parent))
#endif
{
return false;
Expand Down

0 comments on commit 9afa960

Please sign in to comment.