From 2441ffcb52510783d3f4bef714461429687e7d4d Mon Sep 17 00:00:00 2001 From: Donerkebap13 Date: Sun, 16 Sep 2018 17:19:53 +0200 Subject: [PATCH] - Fixing tag parse error --- DonerComponents/source/common/tags/CTagsManager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/DonerComponents/source/common/tags/CTagsManager.cpp b/DonerComponents/source/common/tags/CTagsManager.cpp index 308eb53..732daa0 100644 --- a/DonerComponents/source/common/tags/CTagsManager.cpp +++ b/DonerComponents/source/common/tags/CTagsManager.cpp @@ -91,8 +91,8 @@ namespace DonerComponents DC_ERROR_MSG(EErrorCode::FileNotFound, "error opening %s", path); return false; } - - return ParseTagsFromJson((const char*)mdp.GetBaseData()); + std::string zeroTerminatedStr((const char*)mdp.GetBaseData(), mdp.GetSize()); + return ParseTagsFromJson(zeroTerminatedStr.c_str()); } bool CTagsManager::ParseTagsFromMemory(const unsigned char* jsonStringBuffer, std::size_t size) @@ -103,8 +103,8 @@ namespace DonerComponents DC_ERROR_MSG(EErrorCode::ReadFromBufferFailed, "Error reading from Buffer"); return false; } - - return ParseTagsFromJson((const char*)mdp.GetBaseData()); + std::string zeroTerminatedStr((const char*)mdp.GetBaseData(), mdp.GetSize()); + return ParseTagsFromJson(zeroTerminatedStr.c_str()); } bool CTagsManager::ParseTagsFromJson(const char* const jsonStr)