From a35b28fc57f543d417568976147daf9c803b2d29 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 17 Jun 2024 16:09:55 +0200 Subject: [PATCH] might be an important fix --- CHANGELOG.md | 5 +++++ linux/payload/plocMpsocHelpers.h | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 784ec061..1c45e96c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,11 @@ will consitute of a breaking change warranting a new major release: # [unreleased] +## Fixed + +- Added null termination for PLOC MPSoC image taking command which could possibly lead to + default target filenames. + # [v8.1.0] 2024-05-29 ## Fixed diff --git a/linux/payload/plocMpsocHelpers.h b/linux/payload/plocMpsocHelpers.h index d596ab6c..35e34b11 100644 --- a/linux/payload/plocMpsocHelpers.h +++ b/linux/payload/plocMpsocHelpers.h @@ -920,13 +920,14 @@ class TcCamTakePic : public TcBase { } size_t deserLen = commandDataLen; size_t serLen = 0; - fileName = reinterpret_cast(commandData); + fileName = std::string(reinterpret_cast(commandData)); if (fileName.size() > MAX_FILENAME_SIZE) { return FILENAME_TOO_LONG; } deserLen -= fileName.length() + 1; *dataPtr += fileName.length() + 1; uint8_t** payloadPtr = &payloadStart; + memset(payloadStart, 0, FILENAME_FIELD_SIZE); memcpy(payloadStart, fileName.data(), fileName.size()); *payloadPtr += FILENAME_FIELD_SIZE; serLen += FILENAME_FIELD_SIZE;