1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2025-04-21 20:41:19 +02:00

Compare commits

..

No commits in common. "f868604ca9efaf9129584f59c463bcdae447378a" and "9054d8d9f5e220b26bd224c2ca46e822addd1a7a" have entirely different histories.

3 changed files with 27 additions and 35 deletions

View File

@ -167,10 +167,8 @@ int16_t DCCEXParser::splitValues(int16_t result[MAX_COMMAND_PARAMS], byte *cmd,
break; break;
if (hot == '\0') if (hot == '\0')
return -1; return -1;
if (hot == '>') { if (hot == '>')
*remainingCmd = '\0'; // terminate the cmd string with 0 instead of '>'
return parameterCount; return parameterCount;
}
state = 2; state = 2;
continue; continue;
@ -267,9 +265,8 @@ void DCCEXParser::parse(const FSH * cmd) {
// See documentation on DCC class for info on this section // See documentation on DCC class for info on this section
void DCCEXParser::parse(Print *stream, byte *com, RingStream *ringStream) { void DCCEXParser::parse(Print *stream, byte *com, RingStream *ringStream) {
// This function can get stings of the form "<C OMM AND>" or "C OMM AND>" // This function can get stings of the form "<C OMM AND>" or "C OMM AND"
// found is true first after the leading "<" has been passed which results // found is true first after the leading "<" has been passed
// in parseOne() getting c="C OMM AND>"
bool found = (com[0] != '<'); bool found = (com[0] != '<');
for (byte *c=com; c[0] != '\0'; c++) { for (byte *c=com; c[0] != '\0'; c++) {
if (found) { if (found) {

View File

@ -126,8 +126,8 @@ void SerialManager::loop2() {
buffer[0] = '\0'; buffer[0] = '\0';
} }
} else { // if (inCommandPayload) } else { // if (inCommandPayload)
if (bufferLength < (COMMAND_BUFFER_SIZE-1)) { if (bufferLength < (COMMAND_BUFFER_SIZE-1))
buffer[bufferLength++] = ch; // advance bufferLength buffer[bufferLength++] = ch;
if (inCommandPayload > PAYLOAD_NORMAL) { if (inCommandPayload > PAYLOAD_NORMAL) {
if (inCommandPayload > 32 + 2) { // String way too long if (inCommandPayload > 32 + 2) { // String way too long
ch = '>'; // we end this nonsense ch = '>'; // we end this nonsense
@ -142,18 +142,14 @@ void SerialManager::loop2() {
} }
if (inCommandPayload == PAYLOAD_NORMAL) { if (inCommandPayload == PAYLOAD_NORMAL) {
if (ch == '>') { if (ch == '>') {
buffer[bufferLength] = '\0'; // This \0 is after the '>' buffer[bufferLength] = '\0';
DCCEXParser::parse(serial, buffer, NULL); // buffer parsed with trailing '>' DCCEXParser::parse(serial, buffer, NULL);
inCommandPayload = PAYLOAD_FALSE; inCommandPayload = PAYLOAD_FALSE;
break; break;
} else if (ch == '"') { } else if (ch == '"') {
inCommandPayload = PAYLOAD_STRING; inCommandPayload = PAYLOAD_STRING;
} }
} }
} else {
DIAG(F("Parse error: input buffer overflow"));
inCommandPayload = PAYLOAD_FALSE;
}
} }
} }
} }

View File

@ -3,8 +3,7 @@
#include "StringFormatter.h" #include "StringFormatter.h"
#define VERSION "5.4.4" #define VERSION "5.4.3"
// 5.4.4 - bugfix in parser, input buffer overrun and trailing > that did break <+>
// 5.4.3 - bugfix changeFn for functions 29..31 // 5.4.3 - bugfix changeFn for functions 29..31
// 5.4.2 - Reversed turnout bugfix // 5.4.2 - Reversed turnout bugfix
// 5.4.1 - ESP32 bugfix packet buffer race // 5.4.1 - ESP32 bugfix packet buffer race