Skip to content

Commit

Permalink
VE.Direct: prefer strncpy over strcpy
Browse files Browse the repository at this point in the history
strcpy is not safe.
  • Loading branch information
schlimmchen committed May 31, 2024
1 parent 88314f9 commit 63370e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/VeDirectFrameHandler/VeDirectFrameHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,12 @@ void VeDirectFrameHandler<T>::processTextData(std::string const& name, std::stri
}

if (name == "SER") {
strcpy(_tmpFrame.serialNr_SER, value.c_str());
strncpy(_tmpFrame.serialNr_SER, value.c_str(), sizeof(_tmpFrame.serialNr_SER));
return;
}

if (name == "FW") {
strcpy(_tmpFrame.firmwareVer_FW, value.c_str());
strncpy(_tmpFrame.firmwareVer_FW, value.c_str(), sizeof(_tmpFrame.firmwareVer_FW));
return;
}

Expand Down

0 comments on commit 63370e8

Please sign in to comment.