diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/JsonParserCacheValue.h b/olp-cpp-sdk-dataservice-read/src/generated/parser/JsonParserCacheValue.h index f2d0552cd..78cae2c87 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/parser/JsonParserCacheValue.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/JsonParserCacheValue.h @@ -28,8 +28,9 @@ template inline T parse(const cache::KeyValueCache::ValueType& cached_json) { rapidjson::Document doc; T result{}; - if (!cached_json.empty() && cached_json.back() == '\0') { - doc.Parse(reinterpret_cast(cached_json.data())); + if (!cached_json.empty()) { + auto* data = static_cast(cached_json.data()); + doc.Parse(static_cast(data), cached_json.size()); if (doc.IsObject() || doc.IsArray()) { from_json(doc, result); } diff --git a/olp-cpp-sdk-dataservice-read/src/repositories/CatalogCacheRepository.cpp b/olp-cpp-sdk-dataservice-read/src/repositories/CatalogCacheRepository.cpp index eb67fc5f5..bce018056 100644 --- a/olp-cpp-sdk-dataservice-read/src/repositories/CatalogCacheRepository.cpp +++ b/olp-cpp-sdk-dataservice-read/src/repositories/CatalogCacheRepository.cpp @@ -128,9 +128,8 @@ void CatalogCacheRepository::PutVersionInfos( OLP_SDK_LOG_DEBUG_F(kLogTag, "PutVersionInfos -> '%s'", key.c_str()); auto list_versions = olp::serializer::serialize(versions); - // include null terminated symbol auto versions_data = std::make_shared( - list_versions.data(), list_versions.data() + list_versions.size() + 1); + list_versions.data(), list_versions.data() + list_versions.size()); cache_->Put(VersionInfosKey(hrn, start, end), versions_data, default_expiry_); }