diff --git a/libraries/EEPROM/EEPROM.h b/libraries/EEPROM/EEPROM.h index c51f759b7..961ff8b08 100644 --- a/libraries/EEPROM/EEPROM.h +++ b/libraries/EEPROM/EEPROM.h @@ -37,7 +37,7 @@ class EEPROMClass template T &get(int address, T &t) { - if (address < 0 || address >= _size) + if (address < 0 || address + sizeof(T) > _size) return t; uint8_t *ptr = (uint8_t*) &t; @@ -47,7 +47,7 @@ class EEPROMClass template const T &put(int address, const T &t) { - if (address < 0 || address >= _size) + if (address < 0 || address + sizeof(T) > _size) return t; const uint8_t *ptr = (const uint8_t*) &t;