Fix for integer overflow

This commit is contained in:
Jonathan Bennett
2026-01-04 20:56:01 -06:00
parent 21c0dcaabb
commit 8ecce1eb5c

View File

@@ -450,7 +450,7 @@ bool StoreForwardPlusPlusModule::handleReceivedProtobuf(const meshtastic_MeshPac
} else {
LOG_DEBUG("StoreForwardpp End of chain does not match! Checking distance behind.");
int64_t links_behind = 0;
if (t->chain_count != 0) {
if (t->chain_count != 0 && t->chain_count > chain_end.counter) {
links_behind = t->chain_count - chain_end.counter;
LOG_DEBUG("StoreForwardpp Links behind: %ld", links_behind);