diff options
| author | 2021-06-10 01:45:43 +0100 | |
|---|---|---|
| committer | 2021-06-10 01:45:43 +0100 | |
| commit | 9482331f147b9d27547e3aaa085dbc3222a342df (patch) | |
| tree | 3dd23874a415a60d12d28398edd9644b196721ca /src/configparser.cpp | |
| parent | Avoid creating unnecessary symlinks. (diff) | |
| download | inspircd++-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.cpp | 8 |
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"); } } |
