Skip to content

Commit

Permalink
Change deprecated strcpy to strcpy_s while decoding strings
Browse files Browse the repository at this point in the history
  • Loading branch information
KonradTkaczykCR committed Jan 9, 2024
1 parent 2b05409 commit 84fc008
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ObjectDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ bool cr::detector::ObjectDetectorParams::decode(uint8_t* data, int dataSize)
initString.clear();
// Use strcpy to copy string with null terminator.
std::array<char, 512> initStringArray;
std::strcpy(initStringArray.data(), reinterpret_cast<char*>(&data[pos]));
strcpy_s(initStringArray.data(), 512, reinterpret_cast<char*>(&data[pos]));
pos += static_cast<int>(std::strlen(initStringArray.data())) + 1;
initString = initStringArray.data();
}
Expand All @@ -642,7 +642,7 @@ bool cr::detector::ObjectDetectorParams::decode(uint8_t* data, int dataSize)
while (pos < dataSize)
{
std::array<char, 512> classNameArray;
std::strcpy(classNameArray.data(), reinterpret_cast<char*>(&data[pos]));
strcpy_s(classNameArray.data(), 512, reinterpret_cast<char*>(&data[pos]));
pos += static_cast<int>(std::strlen(classNameArray.data())) + 1;
classNames.push_back(classNameArray.data());
}
Expand Down

0 comments on commit 84fc008

Please sign in to comment.