Skip to content

Commit

Permalink
[network][fs] entry buffer fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
tschak909 committed Jul 27, 2023
1 parent 4b1328d commit 742aa62
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/network-protocol/FS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include <esp_heap_trace.h>
#include <cstring>

#define ENTRY_BUFFER_SIZE 256

NetworkProtocolFS::NetworkProtocolFS(string *rx_buf, string *tx_buf, string *sp_buf)
: NetworkProtocol(rx_buf, tx_buf, sp_buf)
{
Expand Down Expand Up @@ -86,9 +88,9 @@ bool NetworkProtocolFS::open_dir()
return true;
}

char *entryBuffer = (char *)malloc(256);
char *entryBuffer = (char *)malloc(ENTRY_BUFFER_SIZE);

while (read_dir_entry(entryBuffer, 255) == false)
while (read_dir_entry(entryBuffer, ENTRY_BUFFER_SIZE-1) == false)
{
if (aux2_open & 0x80)
{
Expand All @@ -105,7 +107,7 @@ bool NetworkProtocolFS::open_dir()
}
fserror_to_error();

memset(entryBuffer,0,sizeof(entryBuffer));
memset(entryBuffer,0,ENTRY_BUFFER_SIZE);
}

#ifdef BUILD_ATARI
Expand Down

0 comments on commit 742aa62

Please sign in to comment.