From ac1e1246464e28fe4313ba936a6b8f64ec65bb12 Mon Sep 17 00:00:00 2001 From: Ed Tanous Date: Wed, 10 Jul 2024 22:10:14 -0700 Subject: Make multipart use consistent parse This is an instance of common error #5. Fix it. Tested: Code compiles. Inspection only. Change-Id: I5580a9789930ffab6513a03689b633d5201e72a4 Signed-off-by: Ed Tanous --- redfish-core/lib/update_service.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'redfish-core/lib') diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp index 9a399affa4..683a8cb847 100644 --- a/redfish-core/lib/update_service.hpp +++ b/redfish-core/lib/update_service.hpp @@ -810,8 +810,12 @@ inline std::optional if (param.second == "UpdateParameters") { std::vector tempTargets; - nlohmann::json content = - nlohmann::json::parse(formpart.content); + nlohmann::json content = nlohmann::json::parse(formpart.content, + nullptr, false); + if (content.is_discarded()) + { + return std::nullopt; + } nlohmann::json::object_t* obj = content.get_ptr(); if (obj == nullptr) -- cgit v1.2.3