mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
patterns: Disallow calling of dangerous functions by default
Closes #330
This commit is contained in:
@@ -167,14 +167,14 @@ namespace hex {
|
||||
/* Pattern Language Functions */
|
||||
|
||||
|
||||
void ContentRegistry::PatternLanguageFunctions::add(const Namespace &ns, const std::string &name, u32 parameterCount, const ContentRegistry::PatternLanguageFunctions::Callback &func) {
|
||||
void ContentRegistry::PatternLanguageFunctions::add(const Namespace &ns, const std::string &name, u32 parameterCount, const ContentRegistry::PatternLanguageFunctions::Callback &func, bool dangerous) {
|
||||
std::string functionName;
|
||||
for (auto &scope : ns)
|
||||
functionName += scope + "::";
|
||||
|
||||
functionName += name;
|
||||
|
||||
getEntries()[functionName] = Function { parameterCount, func };
|
||||
getEntries()[functionName] = Function { parameterCount, func, dangerous };
|
||||
}
|
||||
|
||||
std::map<std::string, ContentRegistry::PatternLanguageFunctions::Function>& ContentRegistry::PatternLanguageFunctions::getEntries() {
|
||||
|
||||
Reference in New Issue
Block a user