summaryrefslogtreecommitdiffstats
path: root/lib/edi
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2020-03-24 10:40:18 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2020-03-24 10:40:18 +0100
commitdfc57ff5c9d5af81efaf17f43c83780264d7d22b (patch)
tree3999beee73d48293d2933d9996f2b019587f5304 /lib/edi
parent9fe15716d3aeff387f4dbb7e85ebe22ac5755447 (diff)
downloaddabmux-dfc57ff5c9d5af81efaf17f43c83780264d7d22b.tar.gz
dabmux-dfc57ff5c9d5af81efaf17f43c83780264d7d22b.tar.bz2
dabmux-dfc57ff5c9d5af81efaf17f43c83780264d7d22b.zip
Pull common code c8defb3
Diffstat (limited to 'lib/edi')
-rw-r--r--lib/edi/common.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/edi/common.cpp b/lib/edi/common.cpp
index 134e14b..c892425 100644
--- a/lib/edi/common.cpp
+++ b/lib/edi/common.cpp
@@ -310,15 +310,17 @@ bool TagDispatcher::decode_tagpacket(const vector<uint8_t> &payload)
uint32_t taglength = read_32b(payload.begin() + i + 4);
if (taglength % 8 != 0) {
- etiLog.log(warn, "Invalid tag length: not multiple of 8!");
+ etiLog.log(warn, "Invalid EDI tag length, not multiple of 8!");
break;
}
taglength /= 8;
length = taglength;
- if (i + 8 + taglength >= payload.size()) {
- etiLog.log(warn, "Invalid tag length: tag larger than tagpacket!");
+ const size_t calculated_length = i + 8 + taglength;
+ if (calculated_length > payload.size()) {
+ etiLog.log(warn, "Invalid EDI tag length: tag larger %zu than tagpacket %zu!",
+ calculated_length, payload.size());
break;
}