diff options
author | Collin <iCollin@users.noreply.github.com> | 2021-05-13 10:38:56 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-13 10:38:56 -0400 |
commit | 13fec751d8216b218f49c0b039b67624c7265b50 (patch) | |
tree | 630b32702bb5175510d995315ddd9b9a89c5956b | |
parent | 8fa7c923fe0470bae8dc7201ea2118434ea12e14 (diff) | |
download | sdl_core-13fec751d8216b218f49c0b039b67624c7265b50.tar.gz |
Only call Json::Value::operator[] if PTU value is object type (#3699)
* only call Json::Value::operator[] if it is object type
* short object check
* validate value[data].isArray()
-rw-r--r-- | src/components/policy/policy_regular/src/policy_manager_impl.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/components/policy/policy_regular/src/policy_manager_impl.cc b/src/components/policy/policy_regular/src/policy_manager_impl.cc index b6101eb960..4f2e5043d2 100644 --- a/src/components/policy/policy_regular/src/policy_manager_impl.cc +++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc @@ -112,7 +112,7 @@ std::shared_ptr<policy_table::Table> PolicyManagerImpl::ParseArray( if (reader.parse(json, &value)) { // For PT Update received from SDL Server. - if (value["data"].size() != 0) { + if (value.isObject() && value["data"].isArray() && !value["data"].empty()) { Json::Value data = value["data"]; return std::make_shared<policy_table::Table>(&data[0]); } else { |