File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -79,24 +79,6 @@ namespace
7979 file += newExt;
8080 }
8181
82- // Reject path components in plugin/engine lookup names so DIR_PLUGINS/<name>
83- // cannot escape the plugins directory (path traversal to dlopen).
84- void validatePluginLookupName (const char * pluginName)
85- {
86- if (!pluginName)
87- return ;
88-
89- for (const char * p = pluginName; *p; ++p)
90- {
91- const unsigned char c = static_cast <unsigned char >(*p);
92- if (c == ' /' || c == ' \\ ' )
93- (Arg::Gds (isc_random) << " Invalid characters in plugin name" ).raise ();
94- }
95-
96- if (strstr (pluginName, " .." ))
97- (Arg::Gds (isc_random) << " Invalid characters in plugin name" ).raise ();
98- }
99-
10082 // Holds a reference to plugins.conf file
10183 class StaticConfHolder
10284 {
@@ -798,7 +780,11 @@ namespace
798780
799781 explicit PluginLoadInfo (const char * pluginName)
800782 {
801- validatePluginLookupName (pluginName);
783+ // check for directories in pluginName
784+ PathName path, file;
785+ PathUtils::splitLastComponent (path, file, pluginName);
786+ if (path.hasData ())
787+ (Arg::Gds (isc_random) << " Plugin name should not contain directory separator and path component" ).raise ();
802788
803789 // define default values for plugin ...
804790 curModule = fb_utils::getPrefix (IConfigManager::DIR_PLUGINS, pluginName);
You can’t perform that action at this time.
0 commit comments