From 322feba52feedd4600f4cde72ef10ea5aa235738 Mon Sep 17 00:00:00 2001 From: Sonny Jeon Date: Sat, 20 Sep 2014 08:50:27 -0600 Subject: [PATCH] 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. --- system.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system.c b/system.c index 9079820..b8e2f6b 100644 --- a/system.c +++ b/system.c @@ -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)); } }