mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-23 12:51:24 +01:00
add checks for broken cab ID
This commit is contained in:
parent
df7b890758
commit
3759fc2a1a
@ -286,6 +286,8 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
|
||||
|
||||
if (direction < 0 || direction > 1)
|
||||
break; // invalid direction code
|
||||
if (cab > 10239 || cab < 0)
|
||||
break; // beyond DCC range
|
||||
|
||||
DCC::setThrottle(cab, tspeed, direction);
|
||||
if (params == 4) // send obsolete format T response
|
||||
|
@ -235,6 +235,10 @@ int WiThrottle::getLocoId(byte * cmd) {
|
||||
void WiThrottle::multithrottle(RingStream * stream, byte * cmd){
|
||||
char throttleChar=cmd[1];
|
||||
int locoid=getLocoId(cmd+3); // -1 for *
|
||||
if (locoid > 10239 || locoid < -1) {
|
||||
StringFormatter::send(stream, F("No valid DCC loco %d\n"), locoid);
|
||||
return;
|
||||
}
|
||||
byte * aval=cmd;
|
||||
while(*aval !=';' && *aval !='\0') aval++;
|
||||
if (*aval) aval+=2; // skip ;>
|
||||
|
Loading…
Reference in New Issue
Block a user