Skip to content

Commit b45cf05

Browse files
committed
[FS] potential fix for heap poisoning.
1 parent 6f72c91 commit b45cf05

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/network-protocol/FS.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ bool NetworkProtocolFS::read(unsigned short len)
190190

191191
bool NetworkProtocolFS::read_file(unsigned short len)
192192
{
193-
uint8_t *buf = (uint8_t *)malloc(len);
193+
buf = (uint8_t *)malloc(len);
194194

195195
Debug_printf("NetworkProtocolFS::read_file(%u)\r\n", len);
196196

lib/network-protocol/FS.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ class NetworkProtocolFS : public NetworkProtocol
3030
*/
3131
bool rmdir_implemented = false;
3232

33+
/**
34+
* Internal temporary buffer for read
35+
*/
36+
uint8_t *buf;
37+
3338
/**
3439
* @brief ctor
3540
* @param rx_buf pointer to receive buffer

0 commit comments

Comments
 (0)