diff --git a/src/permission/boolean_permission.h b/src/permission/boolean_permission.h index d1a30972dce..f2fdc8a7f90 100644 --- a/src/permission/boolean_permission.h +++ b/src/permission/boolean_permission.h @@ -5,9 +5,7 @@ #include "permission/permission_base.h" -namespace node { - -namespace permission { +namespace node::permission { // A simple boolean permission that either denies or allows access. // Used for permission scopes that don't need per-resource granularity. @@ -46,9 +44,7 @@ using DenyOnlyPermission = BooleanPermission; // Apply grants access, Drop revokes. using AllowRevokePermission = BooleanPermission; -} // namespace permission - -} // namespace node +} // namespace node::permission #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #endif // SRC_PERMISSION_BOOLEAN_PERMISSION_H_ diff --git a/src/permission/fs_permission.h b/src/permission/fs_permission.h index 3fdb0542f68..f2e1720ed9b 100644 --- a/src/permission/fs_permission.h +++ b/src/permission/fs_permission.h @@ -7,9 +7,7 @@ #include "permission/permission_base.h" #include "util.h" -namespace node { - -namespace permission { +namespace node::permission { class FSPermission final : public PermissionBase { public: @@ -125,9 +123,12 @@ class FSPermission final : public PermissionBase { // Handle optional trailing // path = /home/subdirectory // child = subdirectory/* - if (idx >= path.length() && - child->prefix[i] == node::kPathSeparator) { - continue; + if (idx >= path.length()) { + if (child->prefix[i] == node::kPathSeparator) { + continue; + } + // Path is exhausted but prefix expects more characters + return nullptr; } if (path[idx++] != child->prefix[i]) { @@ -185,9 +186,7 @@ class FSPermission final : public PermissionBase { bool allow_all_out_ = false; }; -} // namespace permission - -} // namespace node +} // namespace node::permission #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #endif // SRC_PERMISSION_FS_PERMISSION_H_