Backup all the infomem before erasing the segment. Thanks to Frederik Hermans for reporting this.

This commit is contained in:
nvt-se 2009-07-21 16:56:33 +00:00
parent 31253a29a1
commit 34a6fc82a3

View file

@ -80,7 +80,7 @@ infomem_write(unsigned int offset, unsigned char count, ...)
return FALSE; return FALSE;
} }
flash = (uint8_t *)INFOMEM_START + offset; flash = (uint8_t *)INFOMEM_START;
s = splhigh(); s = splhigh();
@ -90,9 +90,9 @@ infomem_write(unsigned int offset, unsigned char count, ...)
/* merge backup with new data */ /* merge backup with new data */
va_start(argp, count); va_start(argp, count);
buffer = (uint8_t *)backup; buffer = (uint8_t *)backup + offset;
for(i = 0; i < count; i++) { for(i = 0; i < count; i++) {
data = va_arg(argp, uint8_t*); data = va_arg(argp, uint8_t *);
size = va_arg(argp, uint16_t); size = va_arg(argp, uint16_t);
memcpy(buffer, data, size); memcpy(buffer, data, size);
buffer += size; buffer += size;