0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 09:41:54 +00:00

Fixes bug in BGPv6 causing crash by checking missing attributes.

This commit is contained in:
Ondrej Zajicek 2009-04-23 12:36:24 +02:00
parent e366625c0e
commit b9539e78d8

View File

@ -1359,17 +1359,19 @@ bgp_decode_attrs(struct bgp_conn *conn, byte *attr, unsigned int len, struct lin
mandatory = 1; mandatory = 1;
#endif #endif
/* If there is no (reachability) NLRI, we should exit now */
if (! mandatory)
return a;
/* Check if all mandatory attributes are present */ /* Check if all mandatory attributes are present */
if (mandatory) for(i=0; i < ARRAY_SIZE(bgp_mandatory_attrs); i++)
{ {
for(i=0; i < ARRAY_SIZE(bgp_mandatory_attrs); i++) code = bgp_mandatory_attrs[i];
if (!(seen[code/8] & (1 << (code%8))))
{ {
code = bgp_mandatory_attrs[i]; bgp_error(conn, 3, 3, &bgp_mandatory_attrs[i], 1);
if (!(seen[code/8] & (1 << (code%8)))) return NULL;
{
bgp_error(conn, 3, 3, &bgp_mandatory_attrs[i], 1);
return NULL;
}
} }
} }