summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Orzel <michalx.orzel@intel.com>2022-06-14 16:50:50 +0300
committerMichal Orzel <michalx.orzel@intel.com>2022-06-20 12:47:25 +0300
commit9bc556993f0e13bf024a4e7cba13f8339c02c0d8 (patch)
treed73fab6baa9160e99d84736ac733ad1288016bb1
parent83edb08f2c0fe21b217a4548e722ecadc93bebdf (diff)
downloadbmcweb-9bc556993f0e13bf024a4e7cba13f8339c02c0d8.tar.xz
Fix for segfault in VirtualMedia.InsertMedia
During Virtual Media legacy mount, on URI validation, at some point boost::urls::result<boost::urls::url_view> object is dereferenced, even when it is invalid (this can happen after providing wrong external server in mount configuration). That might eventually cause segmentation fault and bmcweb service to crash. In this fix the problematic dereference is substituted with empty boost::urls::url_view object instead. Tested: Manual verification in browser; issue doesn't reproduce anymore. Change-Id: I2ce8891dcea083bae7be65d37574ac1d56905c77 Signed-off-by: Michal Orzel <michalx.orzel@intel.com> Signed-off-by: Ed Tanous <edtanous@google.com>
-rw-r--r--redfish-core/lib/virtual_media.hpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
index f56069b75e..33540ec873 100644
--- a/redfish-core/lib/virtual_media.hpp
+++ b/redfish-core/lib/virtual_media.hpp
@@ -416,8 +416,9 @@ inline bool
boost::urls::parse_uri(boost::string_view(imageUrl));
if (!url)
{
- messages::resourceAtUriInUnknownFormat(res, *url);
- return {};
+ messages::actionParameterValueFormatError(res, imageUrl, "Image",
+ "InsertMedia");
+ return false;
}
std::optional<TransferProtocol> uriTransferProtocolType =
getTransferProtocolFromUri(*url);