aboutsummaryrefslogtreecommitdiffstats
path: root/lib/edi/common.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2020-03-24 17:52:22 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2020-03-24 17:52:22 +0100
commit6606cb7f6c39096c8259dd1e2356a76baaa0b008 (patch)
tree11ea609b6aef6460df11a920e8ccd20bc2a92ed8 /lib/edi/common.cpp
parent69525b18ee7dc8cb6b56b047ed48bbe870f00e5f (diff)
downloaddabmod-6606cb7f6c39096c8259dd1e2356a76baaa0b008.tar.gz
dabmod-6606cb7f6c39096c8259dd1e2356a76baaa0b008.tar.bz2
dabmod-6606cb7f6c39096c8259dd1e2356a76baaa0b008.zip
Pull add14d9: Properly handle EDI AF SEQ rollover
Diffstat (limited to 'lib/edi/common.cpp')
-rw-r--r--lib/edi/common.cpp4
1 files changed, 3 insertions, 1 deletions
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;