Clean up some buffer allocations
While investigating some memory corruption, I found two bugs: the
backing store the SMBIOS data gets loaded into was left uninitialized,
and the buffer used for the version check was allocated using a pointer
where a size should have been used instead.
Tested: While I can not say for sure this solves the corruption, it
seems to make it much less frequent, during my testing. I am not saying
it is gone, but I can no longer reproduce it.
Change-Id: Ic5d28a0d55cfb179c1bd73e95df2a6bf119f6d8c
Signed-off-by: Josh Lehan <krellan@google.com>
diff --git a/include/mdrv2.hpp b/include/mdrv2.hpp
index 4e431f4..5516fac 100644
--- a/include/mdrv2.hpp
+++ b/include/mdrv2.hpp
@@ -177,7 +177,7 @@
const std::array<uint8_t, 16> smbiosTableId{
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 0x42};
- uint8_t smbiosTableStorage[smbiosTableStorageSize];
+ uint8_t smbiosTableStorage[smbiosTableStorageSize] = {};
bool smbiosIsUpdating(uint8_t index);
bool smbiosIsAvailForUpdate(uint8_t index);