Filter: fixed omitted overflow check in EC constructor
This commit is contained in:
parent
59a86cbc7c
commit
124d860f64
1 changed files with 15 additions and 16 deletions
|
@ -261,7 +261,7 @@
|
||||||
|
|
||||||
FID_MEMBER(enum ec_subtype, ecs, f1->ecs != f2->ecs, "ec subtype %s", ec_subtype_str(item->ecs));
|
FID_MEMBER(enum ec_subtype, ecs, f1->ecs != f2->ecs, "ec subtype %s", ec_subtype_str(item->ecs));
|
||||||
|
|
||||||
int check, ipv4_used;
|
int ipv4_used;
|
||||||
u32 key, val;
|
u32 key, val;
|
||||||
|
|
||||||
if (v1.type == T_INT) {
|
if (v1.type == T_INT) {
|
||||||
|
@ -279,21 +279,20 @@
|
||||||
|
|
||||||
val = v2.val.i;
|
val = v2.val.i;
|
||||||
|
|
||||||
if (ecs == EC_GENERIC) {
|
if (ecs == EC_GENERIC)
|
||||||
check = 0; RESULT(T_EC, ec, ec_generic(key, val));
|
RESULT(T_EC, ec, ec_generic(key, val));
|
||||||
}
|
else if (ipv4_used)
|
||||||
else if (ipv4_used) {
|
if (val <= 0xFFFF)
|
||||||
check = 1; RESULT(T_EC, ec, ec_ip4(ecs, key, val));
|
RESULT(T_EC, ec, ec_ip4(ecs, key, val));
|
||||||
}
|
else
|
||||||
else if (key < 0x10000) {
|
runtime("4-byte value %u can't be used with IP-address key in extended community", val);
|
||||||
check = 0; RESULT(T_EC, ec, ec_as2(ecs, key, val));
|
else if (key < 0x10000)
|
||||||
}
|
RESULT(T_EC, ec, ec_as2(ecs, key, val));
|
||||||
else {
|
else
|
||||||
check = 1; RESULT(T_EC, ec, ec_as4(ecs, key, val));
|
if (val <= 0xFFFF)
|
||||||
}
|
RESULT(T_EC, ec, ec_as4(ecs, key, val));
|
||||||
|
else
|
||||||
if (check && (val > 0xFFFF))
|
runtime("4-byte value %u can't be used with 4-byte ASN in extended community", val);
|
||||||
runtime("Value %u > %u out of bounds in EC constructor", val, 0xFFFF);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
INST(FI_LC_CONSTRUCT, 3, 1) {
|
INST(FI_LC_CONSTRUCT, 3, 1) {
|
||||||
|
|
Loading…
Reference in a new issue