From 925ecf59c1275d6302f914f4c6be2a4a042432d5 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Tue, 24 Mar 2020 17:52:16 +0100 Subject: Pull add14d9: Properly handle EDI AF SEQ rollover --- lib/edi/common.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/edi') diff --git a/lib/edi/common.cpp b/lib/edi/common.cpp index c892425..470b3ba 100644 --- a/lib/edi/common.cpp +++ b/lib/edi/common.cpp @@ -242,7 +242,9 @@ decode_state_t TagDispatcher::decode_afpacket( return {false, 0}; } - if (m_last_seq + (uint16_t)1 != seq) { + // SEQ wraps at 0xFFFF, unsigned integer overflow is intentional + const uint16_t expected_seq = m_last_seq + 1; + if (expected_seq != seq) { etiLog.level(warn) << "EDI AF Packet sequence error, " << seq; } m_last_seq = seq; -- cgit v1.2.3