Skip to content

Commit dcf3165

Browse files
committed
Limit subIndex to 100 to prevent endless loop
1 parent 8eb49f6 commit dcf3165

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/oi_can.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,14 @@ void SendCanMapping(WiFiClient client) {
463463
object["subindex"] = subIndex;
464464
doc.add(object);
465465
subIndex++;
466-
requestSdoElement(index, subIndex); //request next item
467-
reqMapStt = DATAPOSLEN;
466+
467+
if (subIndex < 100) { //limit maximum items in case there is a bug ;)
468+
requestSdoElement(index, subIndex); //request next item
469+
reqMapStt = DATAPOSLEN;
470+
}
471+
else {
472+
reqMapStt = DONE;
473+
}
468474
}
469475
else //should never get here
470476
reqMapStt = DONE;

0 commit comments

Comments
 (0)