summaryrefslogtreecommitdiff
path: root/flash.c
diff options
context:
space:
mode:
authorDaniel Palmer <danieruru@gmail.com>2014-05-20 21:33:40 +0900
committerDaniel Palmer <danieruru@gmail.com>2014-05-20 21:33:40 +0900
commit1b80869b641d15120cfb815bf880b786bd94ff29 (patch)
treed107d07011bce498313dfa7dcf778ab435c65eae /flash.c
parentf71a545ce9bd0835ddd2382f4553fcdc2407d72b (diff)
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.
Diffstat (limited to 'flash.c')
-rw-r--r--flash.c3
1 files changed, 2 insertions, 1 deletions
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