From 3b52651b202484ab470a3c4fe7db13bac13bd191 Mon Sep 17 00:00:00 2001 From: AlexPeshkoff Date: Fri, 9 Dec 2022 18:39:02 +0300 Subject: [PATCH] Implemented #7418: Reliability of plugin manager --- src/yvalve/PluginManager.cpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/yvalve/PluginManager.cpp b/src/yvalve/PluginManager.cpp index 22de9cecbd..195d62ba8f 100644 --- a/src/yvalve/PluginManager.cpp +++ b/src/yvalve/PluginManager.cpp @@ -278,15 +278,29 @@ namespace struct RegisteredPlugin { RegisteredPlugin(IPluginFactory* f, const char* nm, unsigned int t) - : factory(f), name(nm), type(t) - { } + : factory(f), type(t) + { + if (nm) + { + if (strlen(nm) >= sizeof(name)) + { + fatal_exception::raiseFmt("Size of plugin registration name should not exceed %d bytes", + sizeof(name) - 1); + } + strcpy(name, nm); + } + else + name[0] = 0; + } RegisteredPlugin() - : factory(NULL), name(NULL), type(0) - { } + : factory(NULL), type(0) + { + name[0] = 0; + } IPluginFactory* factory; - const char* name; + char name[32]; unsigned int type; };