diff options
author | Daniel Palmer <danieruru@gmail.com> | 2014-05-20 21:33:40 +0900 |
---|---|---|
committer | Daniel Palmer <danieruru@gmail.com> | 2014-05-20 21:33:40 +0900 |
commit | 1b80869b641d15120cfb815bf880b786bd94ff29 (patch) | |
tree | d107d07011bce498313dfa7dcf778ab435c65eae | |
parent | f71a545ce9bd0835ddd2382f4553fcdc2407d72b (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.
-rw-r--r-- | flash.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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 |