From 7f3d28b11b8da68ffdaf94fea8d2cf2031c54fdb Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Wed, 15 Apr 2026 08:59:49 +0200 Subject: [PATCH] CheckPath: Fix to handle current logic --- common/CheckPath.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/common/CheckPath.h b/common/CheckPath.h index ebbb7c4c..e685b526 100644 --- a/common/CheckPath.h +++ b/common/CheckPath.h @@ -8,13 +8,10 @@ #include "JFJochException.h" inline void CheckPath(const std::string &s) { - if (s.empty()) - throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, - "Path cannot be empty"); - if (s.front() == '/') + if (!s.empty() && s.front() == '/') throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Path cannot start with slash"); - if (s.substr(0,3) == "../") + if (s.size() >= 3 && s.substr(0,3) == "../") throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Path cannot start with ../"); if (s.find("/../") != std::string::npos)