From 9afa9609798f07021c23e40983f0ac170cb2c609 Mon Sep 17 00:00:00 2001 From: Eladash Date: Wed, 20 Oct 2021 22:15:54 +0300 Subject: [PATCH] Fix possible fs::create_path recursion overflow --- Utilities/File.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Utilities/File.cpp b/Utilities/File.cpp index 8729999fd8..5497e04262 100644 --- a/Utilities/File.cpp +++ b/Utilities/File.cpp @@ -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;