summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJayaprakash Mutyala <mutyalax.jayaprakash@intel.com>2023-04-18 15:28:38 +0300
committerJayaprakash Mutyala <mutyalax.jayaprakash@intel.com>2023-05-02 21:18:55 +0300
commit452bd8d820151f294f3f735c2b6728351b3af265 (patch)
tree4c49d4d49487625f0243233bd1dc4f24a11407fb
parent46b302837c3c44376da3ba6b72fb70b7b2ce1c11 (diff)
downloadbmcweb-452bd8d820151f294f3f735c2b6728351b3af265.tar.xz
virtual_media: Fix for bmcweb crash
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: Arun Kapale <arunx.kapale@intel.com> Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com> Change-Id: Ib9c7ed668f13943bdacdd9afda0e65d6bcc438d0
-rw-r--r--redfish-core/lib/virtual_media.hpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
index bb17d3f8df..96fd03798e 100644
--- a/redfish-core/lib/virtual_media.hpp
+++ b/redfish-core/lib/virtual_media.hpp
@@ -769,6 +769,16 @@ inline void validateParams(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
*actionParams.imageUrl, *paramTransferProtocolType);
}
+ if (!actionParams.userName)
+ {
+ actionParams.userName = "";
+ }
+
+ if (!actionParams.password)
+ {
+ actionParams.password = "";
+ }
+
doMountVmLegacy(asyncResp, service, resName, *actionParams.imageUrl,
!(*actionParams.writeProtected),
std::move(*actionParams.userName),