Skip to content

Commit 0807dc2

Browse files
committed
ipfix: added contraints for number of process plugins
1 parent 706fe25 commit 0807dc2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

output/ipfix.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ void IPFIXExporter::init(const char *params, Plugins &plugins)
200200
init(params);
201201

202202
extension_cnt = get_extension_cnt();
203+
if (extension_cnt > 64) {
204+
throw PluginError("output plugin operates only with up to 64 running plugins");
205+
}
203206
extensions = new RecordExt*[extension_cnt];
204207
for (int i = 0; i < extension_cnt; i++) {
205208
extensions[i] = nullptr;
@@ -211,7 +214,7 @@ void IPFIXExporter::init(const char *params, Plugins &plugins)
211214
if (ext == nullptr) {
212215
continue;
213216
}
214-
if (ext->m_ext_id > 64) {
217+
if (ext->m_ext_id >= 64) {
215218
throw PluginError("detected plugin ID >64");
216219
} else if (ext->m_ext_id >= extension_cnt) {
217220
throw PluginError("detected plugin ID larger than number of extensions");
@@ -274,7 +277,7 @@ template_t *IPFIXExporter::get_template(const Flow &flow)
274277

275278
RecordExt *ext = flow.m_exts;
276279
while (ext != nullptr) {
277-
if (ext->m_ext_id >= extension_cnt || ext->m_ext_id >= 64) {
280+
if (ext->m_ext_id < 0 || ext->m_ext_id >= extension_cnt) {
278281
throw PluginError("encountered invalid extension id");
279282
}
280283
extensions[ext->m_ext_id] = ext;

0 commit comments

Comments
 (0)