From 81152e07f38b23b8845b40040ecbfd1c5714db6f Mon Sep 17 00:00:00 2001 From: Elizaveta Lobanova Date: Tue, 24 Nov 2020 18:12:16 +0300 Subject: [PATCH] [GNA] Fix a global buffer overflow in GNAModelSerial::Import (#3290) (#3327) --- inference-engine/src/gna_plugin/gna_model_serial.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inference-engine/src/gna_plugin/gna_model_serial.cpp b/inference-engine/src/gna_plugin/gna_model_serial.cpp index b36e4b6..4ed6511 100644 --- a/inference-engine/src/gna_plugin/gna_model_serial.cpp +++ b/inference-engine/src/gna_plugin/gna_model_serial.cpp @@ -172,7 +172,7 @@ void GNAModelSerial::Import(void *basePointer, for (auto inputIndex = 0; inputIndex < modelHeader.nInputs; inputIndex++) { uint32_t nameSize = 0; readNBits<32>(nameSize, is); - std::string inName("", nameSize); + std::string inName(nameSize, '\0'); readNBytes(&inName[0], nameSize, is); inputNames.push_back(inName.substr(0, nameSize - 1)); } @@ -185,7 +185,7 @@ void GNAModelSerial::Import(void *basePointer, for (auto inputIndex = 0; inputIndex < modelHeader.nOutputs; inputIndex++) { uint32_t nameSize = 0; readNBits<32>(nameSize, is); - std::string outName("", nameSize); + std::string outName(nameSize, '\0'); readNBytes(&outName[0], nameSize, is); outputNames.push_back(outName.substr(0, nameSize - 1)); } -- 2.7.4