diff --git a/src/cpuplugin/cpuplugin.cpp b/src/cpuplugin/cpuplugin.cpp index 28463bd..25f3b55 100644 --- a/src/cpuplugin/cpuplugin.cpp +++ b/src/cpuplugin/cpuplugin.cpp @@ -172,7 +172,8 @@ agentCoreFunctions CpuPlugin::aCF; AppendCPUTime(contentss); std::string content = contentss.str(); - data->size = static_cast(content.length()); // should data->size be a size_t? + uint32 cSize = static_cast(content.length() + 1); // +1 to include null terminator + data->size = cSize; // should data->size be a size_t? data->data = NewCString(content); } else { if (!IsValidData(instance->current)) { diff --git a/src/envplugin/envplugin.cpp b/src/envplugin/envplugin.cpp index 052eb5b..4d2d323 100644 --- a/src/envplugin/envplugin.cpp +++ b/src/envplugin/envplugin.cpp @@ -169,7 +169,8 @@ monitordata* EnvPlugin::OnRequestData() { AppendSystemInfo(contentss); std::string content = contentss.str(); - data->size = static_cast(content.length()); // should data->size be a size_t? + uint32 cSize = static_cast(content.length() + 1); // +1 to include null terminator + data->size = cSize; // should data->size be a size_t? data->data = NewCString(content); data->persistent = false; aCF.logMessage(debug, "<<size = len; data->data = sval; + data->size = len + 1; // +1 to include null terminator } aCF.logMessage(debug, "<<