Minor settings number overflow bug fix.

- The `x` in `$x=val` would overflow when a value larger than 255 was
entered and passed to Grbl. This resulted with unintended parameters
being set by the overflow value. To fix, simply check for values larger
than 255 and error out.
This commit is contained in:
Sonny Jeon 2014-09-20 08:50:27 -06:00
parent 5edf078065
commit 322feba52f

View File

@ -190,7 +190,7 @@ uint8_t system_execute_line(char *line)
}
} else { // Store global setting.
if(!read_float(line, &char_counter, &value)) { return(STATUS_BAD_NUMBER_FORMAT); }
if(line[char_counter] != 0) { return(STATUS_INVALID_STATEMENT); }
if((line[char_counter] != 0) || (parameter > 255)) { return(STATUS_INVALID_STATEMENT); }
return(settings_store_global_setting((uint8_t)parameter, value));
}
}