more documentation
This commit is contained in:
parent
5c01401042
commit
33ad5e57ca
@ -114,11 +114,14 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_
|
||||
switch(actionId) {
|
||||
case(LIST_DIRECTORY_INTO_FILE): {
|
||||
// TODO: Packet definition for clean deserialization
|
||||
// Two bytes for a and R flag, at least 5 bytes for minimum valid path /tmp with
|
||||
// null termination
|
||||
if(size < 7) {
|
||||
// 2 bytes for a and R flag, at least 5 bytes for minimum valid path /tmp with
|
||||
// null termination, at least 7 bytes for minimum target file name /tmp/a with
|
||||
// null termination.
|
||||
if(size < 14) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
// We could also make -l optional, but I can't think of a reason why to not use -l..
|
||||
|
||||
// This flag specifies to run ls with -a
|
||||
bool aFlag = data[0];
|
||||
data += 1;
|
||||
@ -128,7 +131,7 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_
|
||||
|
||||
size_t remainingSize = size - 2;
|
||||
// One larger for null termination, which prevents undefined behaviour if the sent
|
||||
// string is not 0 terminated
|
||||
// strings are not 0 terminated properly
|
||||
std::vector<uint8_t> repoAndTargetFileBuffer(remainingSize + 1, 0);
|
||||
std::memcpy(repoAndTargetFileBuffer.data(), data, remainingSize);
|
||||
const char* currentCharPtr = reinterpret_cast<const char*>(repoAndTargetFileBuffer.data());
|
||||
|
Loading…
Reference in New Issue
Block a user