summaryrefslogtreecommitdiffstats
path: root/lib/edi/common.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/edi/common.cpp')
-rw-r--r--lib/edi/common.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/edi/common.cpp b/lib/edi/common.cpp
index 87a15ce..e4a51b4 100644
--- a/lib/edi/common.cpp
+++ b/lib/edi/common.cpp
@@ -307,13 +307,18 @@ 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!");
+ etiLog.log(warn, "Invalid 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!");
+ break;
+ }
+
vector<uint8_t> tag_value(taglength);
copy( payload.begin() + i+8,
payload.begin() + i+8+taglength,