aboutsummaryrefslogtreecommitdiff
path: root/primedev/plugins/plugins.cpp
diff options
context:
space:
mode:
authorJan <sentrycraft123@gmail.com>2024-05-05 18:00:04 +0200
committerGitHub <noreply@github.com>2024-05-05 18:00:04 +0200
commitab653555f6aa0ec57e1b23a590fb3061929fdc30 (patch)
treef778b5995bc87f74b770f17eabe5dfc290253eec /primedev/plugins/plugins.cpp
parent9a64c1885c07a933563b5d296d848af7ebb0a02d (diff)
downloadNorthstarLauncher-ab653555f6aa0ec57e1b23a590fb3061929fdc30.tar.gz
NorthstarLauncher-ab653555f6aa0ec57e1b23a590fb3061929fdc30.zip
Fix plugin with NULL strings causing UB (#695)
Instance string members only after checking for null pointers to prevent UB
Diffstat (limited to 'primedev/plugins/plugins.cpp')
-rw-r--r--primedev/plugins/plugins.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/primedev/plugins/plugins.cpp b/primedev/plugins/plugins.cpp
index eddaa8ac..ae6fd0cb 100644
--- a/primedev/plugins/plugins.cpp
+++ b/primedev/plugins/plugins.cpp
@@ -69,10 +69,6 @@ Plugin::Plugin(std::string path) : m_location(path)
m_runOnServer = context & PluginContext::DEDICATED;
m_runOnClient = context & PluginContext::CLIENT;
- m_name = std::string(name);
- m_logName = std::string(logName);
- m_dependencyName = std::string(dependencyName);
-
if (!name)
{
NS::log::PLUGINSYS->error("Could not load name of plugin at '{}'", path);
@@ -91,6 +87,10 @@ Plugin::Plugin(std::string path) : m_location(path)
return;
}
+ m_name = std::string(name);
+ m_logName = std::string(logName);
+ m_dependencyName = std::string(dependencyName);
+
if (!isValidSquirrelIdentifier(m_dependencyName))
{
NS::log::PLUGINSYS->error("Dependency name \"{}\" of plugin {} is not valid", dependencyName, name);