FreeCalypso > hg > freecalypso-hwlab
changeset 34:ae48b7d69744
ftee-gen2232c: added guard against strings overflowing EEPROM space
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 21 Apr 2019 18:50:33 +0000 |
parents | dc334ef19cd4 |
children | a79b0240534a |
files | fteeprom/ftee-gen2232c.c |
diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/fteeprom/ftee-gen2232c.c Sun Apr 21 17:51:32 2019 +0000 +++ b/fteeprom/ftee-gen2232c.c Sun Apr 21 18:50:33 2019 +0000 @@ -95,6 +95,10 @@ { unsigned longlen, startptr; + if (63 - eeprom_string_ptr < strlen(str) + 1) { + fprintf(stderr, "error: strings are too long\n"); + exit(1); + } longlen = strlen(str) * 2 + 2; startptr = eeprom_string_ptr; eeprom[eeprom_string_ptr++] = 0x0300 | longlen;