From fcea38b48c9e58a6a3ddf6f309581c91e2a2dd8a Mon Sep 17 00:00:00 2001 From: Patrick LeBlanc Date: Mon, 4 Feb 2019 17:36:50 -0600 Subject: [PATCH] Fixed the msg length in listdirectory again. --- src/ListDirectoryTask.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ListDirectoryTask.cpp b/src/ListDirectoryTask.cpp index 259cfe210..5c4e4c646 100644 --- a/src/ListDirectoryTask.cpp +++ b/src/ListDirectoryTask.cpp @@ -79,13 +79,13 @@ bool ListDirectoryTask::run() } // be careful modifying the listdir return types... - uint payloadLen = sizeof(listdir_resp_entry) * listing.size(); + uint payloadLen = sizeof(listdir_resp) + (sizeof(listdir_resp_entry) * listing.size()); for (uint i = 0; i < listing.size(); i++) payloadLen += listing[i].size(); sm_msg_resp *resp = (sm_msg_resp *) buf; resp->type = SM_MSG_START; - resp->payloadLen = payloadLen + sizeof(listdir_resp); + resp->payloadLen = payloadLen + 4; // the +4 is for the length of the return code resp->returnCode = 0; listdir_resp *r = (listdir_resp *) resp->payload; r->elements = listing.size();