diff options
author | Michael J. Chudobiak <mjc@avtechpulse.com> | 2012-10-19 10:26:00 -0400 |
---|---|---|
committer | Michael J. Chudobiak <mjc@avtechpulse.com> | 2012-10-19 10:26:00 -0400 |
commit | b394fbca77e84752d140d05857bc10ea225a79af (patch) | |
tree | f31a3208641fd0d9be461d2e76fa0d6b112f9beb | |
parent | f6d4c6065c0c45c166ec59e155c1cb6a49885be2 (diff) |
added value range checks to eprom char and int writes
-rw-r--r-- | parser.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -1222,6 +1222,11 @@ static int Go_int_eprom_48(gchar** response, int channel, char *loc_string,char switch (command_type) { case command_param_units: the_number=(short) atoi(store_string); + + if ((the_number < 0) || (the_number > 0xffff)) { + return OutOfRange; + } + *(short *)(&globals.Flash.flash_start + eprom_loc) = the_number; writeUserBlock(&globals.Flash, eprom_loc, sizeof (the_number)); return OK; @@ -1291,6 +1296,11 @@ static int Go_char_eprom_70(gchar** response, int channel, char *loc_string,char switch (command_type) { case command_param_units: the_number=(char) atoi(store_string); + + if ((the_number < 0) || (the_number > 0xff)) { + return OutOfRange; + } + *(char *)(&globals.Flash.flash_start + eprom_loc)=the_number; writeUserBlock(&globals.Flash, eprom_loc, sizeof(the_number)); |