Commit d66e69e76555ea18c8bc8c1c8b72fb051061965d
authorMichel Pollet <buserror@gmail.com>
Wed, 6 Jan 2010 22:44:15 +0000 (22:44 +0000)
committerMichel Pollet <buserror@gmail.com>
Wed, 6 Jan 2010 22:47:18 +0000 (22:47 +0000)
Prevented loading the eeprom entire size

Signed-off-by: Michel Pollet <buserror@gmail.com>
simavr/sim/avr_eeprom.c

index b61916cd1c65fba25a99b02878d0dc0cfad68447..60043eed85e68b5efa512113d4587bc034b00408 100644 (file)
@@ -87,7 +87,7 @@ static int avr_eeprom_ioctl(struct avr_io_t * port, uint32_t ctl, void * io_para
        switch(ctl) {
                case AVR_IOCTL_EEPROM_SET: {
                        avr_eeprom_desc_t * desc = (avr_eeprom_desc_t*)io_param;
-                       if (!desc || !desc->size || !desc->ee || (desc->offset + desc->size) >= p->size) {
+                       if (!desc || !desc->size || !desc->ee || (desc->offset + desc->size) > p->size) {
                                printf("%s: AVR_IOCTL_EEPROM_SET Invalid argument\n",
                                                __FUNCTION__);
                                return -2;
@@ -98,7 +98,7 @@ static int avr_eeprom_ioctl(struct avr_io_t * port, uint32_t ctl, void * io_para
                }       break;
                case AVR_IOCTL_EEPROM_GET: {
                        avr_eeprom_desc_t * desc = (avr_eeprom_desc_t*)io_param;
-                       if (!desc || (desc->offset + desc->size) >= p->size) {
+                       if (!desc || (desc->offset + desc->size) > p->size) {
                                printf("%s: AVR_IOCTL_EEPROM_GET Invalid argument\n",
                                                __FUNCTION__);
                                return -2;