Skip to content

Commit 684f8d5

Browse files
committed
pcn-iptables: fix rule id check when inserting rule
Signed-off-by: Matteo Bertrone <m.bertrone@gmail.com>
1 parent def7cb5 commit 684f8d5

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/services/pcn-iptables/src/Chain.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ ChainInsertOutputJsonObject Chain::insert(ChainInsertInputJsonObject input) {
232232
id = input.getId();
233233
}
234234

235+
if (id > rules_.size()) {
236+
throw std::runtime_error("id not allowed");
237+
}
238+
235239
auto newRule = std::make_shared<ChainRule>(*this, conf);
236240

237241
ChainStatsJsonObject confStats;
@@ -1072,4 +1076,4 @@ void Chain::delRuleList() {
10721076
if (parent_.interactive_) {
10731077
applyRules();
10741078
}
1075-
}
1079+
}

0 commit comments

Comments
 (0)