From 1b80869b641d15120cfb815bf880b786bd94ff29 Mon Sep 17 00:00:00 2001 From: Daniel Palmer Date: Tue, 20 May 2014 21:33:40 +0900 Subject: If the struct coming in from disk is smaller than the request size don't read the last byte. This stops it from running over a byte that is now where the flash end used to be. --- flash.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'flash.c') diff --git a/flash.c b/flash.c index 70286d6..57f8fc0 100644 --- a/flash.c +++ b/flash.c @@ -252,7 +252,8 @@ bool persistence_unfreeze(char* dest, void* result, unsigned int len, uint32_t v #if FROZENSMALLEROK if (hdr.length < len) { - printf("frozen struct is %d bytes smaller than the requested size\n", len - hdr.length); + printf("frozen struct is %d bytes smaller than the requested size, removing end byte\n", len - hdr.length); + hdr.length -= 1; goto hdrlengthok; } #endif -- cgit