summaryrefslogtreecommitdiff
path: root/include/dbus_privileges.hpp
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2023-07-27 19:33:49 +0300
committerEd Tanous <ed@tanous.net>2023-07-28 18:23:44 +0300
commitd3dfb6eba0a4b95eb6630c289fa80be2203861e8 (patch)
tree75793dff48740d5366fa900f08ec8f5d726ef6b1 /include/dbus_privileges.hpp
parente7245fe847e7282522a7979f816fd76f925348d3 (diff)
downloadbmcweb-d3dfb6eba0a4b95eb6630c289fa80be2203861e8.tar.xz
Add missing nullptr checks
These were found by inspection, and should be cases that aren't possible, but we should be consistent. Check the pointers for null before dereferencing. Tested: Inspection only. Condition theoretically not possible to hit. Change-Id: I1423bb5bae5445d2b4b0cee2f3315b3ddd1c3836 Signed-off-by: Ed Tanous <edtanous@google.com>
Diffstat (limited to 'include/dbus_privileges.hpp')
-rw-r--r--include/dbus_privileges.hpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/dbus_privileges.hpp b/include/dbus_privileges.hpp
index 65b4042492..fca4a137d3 100644
--- a/include/dbus_privileges.hpp
+++ b/include/dbus_privileges.hpp
@@ -40,6 +40,11 @@ inline bool
return false;
}
+ if (req.session == nullptr)
+ {
+ return false;
+ }
+
if (userRolePtr != nullptr)
{
req.session->userRole = *userRolePtr;
@@ -93,6 +98,10 @@ inline bool
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
BaseRule& rule)
{
+ if (req.session == nullptr)
+ {
+ return false;
+ }
// Get the user's privileges from the role
redfish::Privileges userPrivileges =
redfish::getUserPrivileges(*req.session);