From b45cf05c05ed014540bc377d3e7b8b6887d62b85 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sat, 12 Aug 2023 19:08:37 -0500 Subject: [PATCH] [FS] potential fix for heap poisoning. --- lib/network-protocol/FS.cpp | 2 +- lib/network-protocol/FS.h | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/network-protocol/FS.cpp b/lib/network-protocol/FS.cpp index 24a65d2d1..cac9232fb 100755 --- a/lib/network-protocol/FS.cpp +++ b/lib/network-protocol/FS.cpp @@ -190,7 +190,7 @@ bool NetworkProtocolFS::read(unsigned short len) bool NetworkProtocolFS::read_file(unsigned short len) { - uint8_t *buf = (uint8_t *)malloc(len); + buf = (uint8_t *)malloc(len); Debug_printf("NetworkProtocolFS::read_file(%u)\r\n", len); diff --git a/lib/network-protocol/FS.h b/lib/network-protocol/FS.h index 8d6f078ad..d6b30527c 100755 --- a/lib/network-protocol/FS.h +++ b/lib/network-protocol/FS.h @@ -30,6 +30,11 @@ class NetworkProtocolFS : public NetworkProtocol */ bool rmdir_implemented = false; + /** + * Internal temporary buffer for read + */ + uint8_t *buf; + /** * @brief ctor * @param rx_buf pointer to receive buffer