mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-27 20:56:35 +00:00
Add more failsafe to autoexec.bat
This commit is contained in:
parent
af540205a7
commit
0aac8125ea
@ -363,16 +363,19 @@ void UfsAutoexec(void) {
|
|||||||
file.read(buf, 1);
|
file.read(buf, 1);
|
||||||
if ((buf[0] == '\n') || (buf[0] == '\r')) {
|
if ((buf[0] == '\n') || (buf[0] == '\r')) {
|
||||||
// Line terminated with linefeed or carriage return
|
// Line terminated with linefeed or carriage return
|
||||||
break;
|
if (index < sizeof(cmd_line) - 1) {
|
||||||
|
// Process line
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
// Discard too long line and start with next line
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ((0 == index) && isspace(buf[0])) {
|
else if ((0 == index) && isspace(buf[0])) {
|
||||||
// Skip leading spaces (' ','\t','\n','\v','\f','\r')
|
// Skip leading spaces (' ','\t','\n','\v','\f','\r')
|
||||||
} else {
|
}
|
||||||
cmd_line[index] = buf[0];
|
else if (index < sizeof(cmd_line) - 2) {
|
||||||
index++;
|
cmd_line[index++] = buf[0];
|
||||||
if (index >= sizeof(cmd_line) - 1) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((index > 0) && (cmd_line[0] != ';')) { // Information but no comment
|
if ((index > 0) && (cmd_line[0] != ';')) { // Information but no comment
|
||||||
|
Loading…
x
Reference in New Issue
Block a user