summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Tanous <ed@tanous.net>2024-04-06 23:52:01 +0300
committerEd Tanous <ed@tanous.net>2024-04-10 20:18:18 +0300
commit2b9c1dfece51feb6f3f44a6b7a7e5802f5dff416 (patch)
tree66b1f45f56e6c2a871a6789b0e714eb33d599d44
parent3cd7072b9fff77731b959b2f7b3e3750e50abfe4 (diff)
downloadbmcweb-2b9c1dfece51feb6f3f44a6b7a7e5802f5dff416.tar.xz
Fix account service
Session might not be initialized, and might be nullptr. This line was accessing the session BEFORE the nullptr check. Move it to after. Found using static analysis. Change-Id: I966c642aee7c76a29c7d0d57d3b78f5f7bef7d62 Signed-off-by: Ed Tanous <ed@tanous.net>
-rw-r--r--redfish-core/lib/account_service.hpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index 47fb58d902..dc393ae883 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -1899,14 +1899,14 @@ inline void
std::optional<bool> locked;
std::optional<std::vector<std::string>> accountTypes;
- bool userSelf = (username == req.session->username);
-
if (req.session == nullptr)
{
messages::internalError(asyncResp->res);
return;
}
+ bool userSelf = (username == req.session->username);
+
Privileges effectiveUserPrivileges =
redfish::getUserPrivileges(*req.session);
Privileges configureUsers = {"ConfigureUsers"};