From 348186f045f23d59405ac0011e983aea8334598a Mon Sep 17 00:00:00 2001 From: Jayaprakash Mutyala Date: Thu, 4 May 2023 13:56:27 +0000 Subject: [PATCH] virtual_media: Fix for bmcweb crash This is ported from main line. https://gerrit.openbmc.org/c/openbmc/bmcweb/+/62593 bmcweb crashes when user not providing userName or password while posting ISO form Redfish. This fix provides to avoid bmcweb crash when user try to post ISO images from Redfish without providing username or password. Tested: Redfish validator passed with this change. Verified by Posting ISO from Redfish. Signed-off-by: Jayaprakash Mutyala --- redfish-core/lib/virtual_media.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp index 6dfc726b..838a08b1 100644 --- a/redfish-core/lib/virtual_media.hpp +++ b/redfish-core/lib/virtual_media.hpp @@ -1069,6 +1069,16 @@ inline void requestNBDVirtualMediaRoutes(App& app) return true; } + if (!actionParams.userName) + { + actionParams.userName = ""; + } + + if (!actionParams.password) + { + actionParams.password = ""; + } + // manager is irrelevant for // VirtualMedia dbus calls doMountVmLegacy(asyncResp, service, resName, -- 2.17.1