might be an important fix #904

Merged
meggert merged 3 commits from possible-fix-mpsoc-take-pic into main 2024-06-24 11:23:10 +02:00
2 changed files with 7 additions and 1 deletions

View File

@ -21,6 +21,11 @@ will consitute of a breaking change warranting a new major release:
- STR quaternions are now used by the `MEKF` by default - STR quaternions are now used by the `MEKF` by default
- Changed nominal `SUS Assembly` side to `B Side`. - Changed nominal `SUS Assembly` side to `B Side`.
## Fixed
- Added null termination for PLOC MPSoC image taking command which could possibly lead to
default target filenames.
# [v8.1.1] 2024-06-05 # [v8.1.1] 2024-06-05
## Added ## Added

View File

@ -920,13 +920,14 @@ class TcCamTakePic : public TcBase {
} }
size_t deserLen = commandDataLen; size_t deserLen = commandDataLen;
size_t serLen = 0; size_t serLen = 0;
fileName = reinterpret_cast<const char*>(commandData); fileName = std::string(reinterpret_cast<const char*>(commandData));
if (fileName.size() > MAX_FILENAME_SIZE) { if (fileName.size() > MAX_FILENAME_SIZE) {
return FILENAME_TOO_LONG; return FILENAME_TOO_LONG;
} }
deserLen -= fileName.length() + 1; deserLen -= fileName.length() + 1;
*dataPtr += fileName.length() + 1; *dataPtr += fileName.length() + 1;
uint8_t** payloadPtr = &payloadStart; uint8_t** payloadPtr = &payloadStart;
memset(payloadStart, 0, FILENAME_FIELD_SIZE);
memcpy(payloadStart, fileName.data(), fileName.size()); memcpy(payloadStart, fileName.data(), fileName.size());
*payloadPtr += FILENAME_FIELD_SIZE; *payloadPtr += FILENAME_FIELD_SIZE;
serLen += FILENAME_FIELD_SIZE; serLen += FILENAME_FIELD_SIZE;