aboutsummaryrefslogtreecommitdiffstats
path: root/src/configparser.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2021-06-10 01:45:43 +0100
committerGravatar Sadie Powell2021-06-10 01:45:43 +0100
commit9482331f147b9d27547e3aaa085dbc3222a342df (patch)
tree3dd23874a415a60d12d28398edd9644b196721ca /src/configparser.cpp
parentAvoid creating unnecessary symlinks. (diff)
downloadinspircd++-9482331f147b9d27547e3aaa085dbc3222a342df.tar.gz
inspircd++-9482331f147b9d27547e3aaa085dbc3222a342df.tar.bz2
inspircd++-9482331f147b9d27547e3aaa085dbc3222a342df.zip
Fix undefined behaviour with converting a path to a string.
Diffstat (limited to 'src/configparser.cpp')
-rw-r--r--src/configparser.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/configparser.cpp b/src/configparser.cpp
index 418542570..65ee663ae 100644
--- a/src/configparser.cpp
+++ b/src/configparser.cpp
@@ -402,10 +402,14 @@ void ParseStack::DoInclude(std::shared_ptr<ConfigTag> tag, int flags)
{
for (const auto& entry : std::filesystem::directory_iterator(includedir))
{
- if (!entry.is_regular_file() || !InspIRCd::Match(ConvToStr(entry.path().filename()), "*.conf"))
+ if (!entry.is_regular_file())
continue;
- if (!ParseFile(entry.path().string(), flags, mandatorytag))
+ const std::string path = entry.path().string();
+ if (!InspIRCd::Match(path, "*.conf"))
+ continue;
+
+ if (!ParseFile(path, flags, mandatorytag))
throw CoreException("Included");
}
}