From 9482331f147b9d27547e3aaa085dbc3222a342df Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Thu, 10 Jun 2021 01:45:43 +0100 Subject: Fix undefined behaviour with converting a path to a string. --- src/configparser.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/configparser.cpp') 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 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"); } } -- cgit v1.3.1-10-gc9f91