From 63370e8a831a09a6bb2c7bad1afadae48dcef924 Mon Sep 17 00:00:00 2001 From: Bernhard Kirchen Date: Wed, 29 May 2024 14:07:59 +0200 Subject: [PATCH] VE.Direct: prefer strncpy over strcpy strcpy is not safe. --- lib/VeDirectFrameHandler/VeDirectFrameHandler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/VeDirectFrameHandler/VeDirectFrameHandler.cpp b/lib/VeDirectFrameHandler/VeDirectFrameHandler.cpp index d299268df..0c434a4c7 100644 --- a/lib/VeDirectFrameHandler/VeDirectFrameHandler.cpp +++ b/lib/VeDirectFrameHandler/VeDirectFrameHandler.cpp @@ -242,12 +242,12 @@ void VeDirectFrameHandler::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; }