diff options
author | Wludzik, Jozef <jozef.wludzik@intel.com> | 2020-09-11 15:55:59 +0300 |
---|---|---|
committer | Jozef Wludzik <jozef.wludzik@intel.com> | 2020-09-24 10:33:52 +0300 |
commit | 4841191fed358da53d4c00c9866151dce54bd6a2 (patch) | |
tree | 0af42d611baf08f95d679dad0a329ff5f4f4e310 | |
parent | 57fce80e24cfe08e530e0697d6c70bba14076d1c (diff) | |
download | bmcweb-4841191fed358da53d4c00c9866151dce54bd6a2.tar.xz |
Response with internal error on invalid Chassis path
Added verification of chassis path in case if received path is
invalid. Response with internal error on wrong format of a path.
Tested:
- Verify if chassis collection is filled properly
- Verify if internal error is returned on wrong path
- RedfishServiceValidator.py passes
Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
Change-Id: Ibe2b9a12d0a5c2c05c9db502b65d2196851352b5
-rw-r--r-- | redfish-core/lib/chassis.hpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp index 4e221cd768..b0690c8d49 100644 --- a/redfish-core/lib/chassis.hpp +++ b/redfish-core/lib/chassis.hpp @@ -204,7 +204,14 @@ class ChassisCollection : public Node if (lastPos == std::string::npos) { BMCWEB_LOG_ERROR << "Failed to find '/' in " << objpath; - continue; + messages::internalError(asyncResp->res); + return; + } + if ((lastPos + 1) >= objpath.size()) + { + BMCWEB_LOG_ERROR << "Failed to parse path " << objpath; + messages::internalError(asyncResp->res); + return; } chassisArray.push_back( {{"@odata.id", "/redfish/v1/Chassis/" + |