From dfc57ff5c9d5af81efaf17f43c83780264d7d22b Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Tue, 24 Mar 2020 10:40:18 +0100 Subject: Pull common code c8defb3 --- lib/edi/common.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib') 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 &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; } -- cgit v1.2.3