Skip to content

Commit 8ae6839

Browse files
committed
Modify config.cxx
Signed-off-by: Hyunji Kim <Hyunji.Kim@amd.com>
1 parent 73cbd9c commit 8ae6839

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/runtime_src/core/edge/common_em/config.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,8 +621,9 @@ namespace xclemulation{
621621
std::string mName = prop.second.get_value<std::string>();
622622
if(mName.empty() == false)
623623
{
624-
if(strlen(mName.c_str()) < 256)//info.mName is static array of size 256
625-
std::memcpy(info.mName, mName.c_str(), strlen(mName.c_str()) + 1);
624+
const auto len = std::min(mName.size(), sizeof(info.mName) - 1);
625+
std::memcpy(info.mName, mName.c_str(), len);
626+
info.mName[len] = '\0';
626627
}
627628
}
628629
else if(prop.first == "HalMajorVersion")

0 commit comments

Comments
 (0)