Skip to content

Commit a3d7dbe

Browse files
leogrirozzo-1A
authored andcommitted
fix: use has_root_path() for cross-platform plugin library path check
Co-authored-by: irozzo-1A <iacopo@sysdig.com> Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
1 parent f4bb2ea commit a3d7dbe

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

userspace/falco/configuration.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,7 @@ struct convert<falco_configuration::plugin_config> {
402402
}
403403
rhs.m_library_path = node["library_path"].as<std::string>();
404404
if(!rhs.m_library_path.empty() &&
405-
!std::filesystem::path(rhs.m_library_path).is_absolute() &&
406-
rhs.m_library_path.at(0) != '/') {
405+
!std::filesystem::path(rhs.m_library_path).has_root_path()) {
407406
// Relative path: resolve against the plugins directory
408407
// and verify the result stays within it.
409408
auto full_path = std::filesystem::path(FALCO_ENGINE_PLUGINS_DIR) / rhs.m_library_path;

0 commit comments

Comments
 (0)