]> git.puffer.fish Git - matthieu/frr.git/commitdiff
isisd: pull up invalid prefix assert()
authorDavid Lamparter <equinox@opensourcerouting.org>
Tue, 8 May 2012 04:27:04 +0000 (06:27 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Thu, 25 Oct 2012 17:15:59 +0000 (10:15 -0700)
processing invalid prefixes causes isisd to assert() or otherwise
misbehave in ip_masklen/apply_mask.  pull up the assert() to indicate
better there's broken data in isisd's LSDB.

  * isisd/isis_spf.c: assert() prefix lengths

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
isisd/isis_spf.c

index 198104a98d22938c211ab27490f70875ea4f23f4..eff7c476174bde6ab9290df1e2081d30c6b86a72 100644 (file)
@@ -813,6 +813,8 @@ lspfragloop:
     for (ALL_LIST_ELEMENTS_RO (lsp->tlv_data.te_ipv4_reachs,
                                node, te_ipv4_reach))
     {
+      assert ((te_ipv4_reach->control & 0x3F) <= IPV4_MAX_BITLEN);
+
       dist = cost + ntohl (te_ipv4_reach->te_metric);
       vtype = VTYPE_IPREACH_TE;
       prefix.u.prefix4 = newprefix2inaddr (&te_ipv4_reach->prefix_start,
@@ -829,6 +831,8 @@ lspfragloop:
     prefix.family = AF_INET6;
     for (ALL_LIST_ELEMENTS_RO (lsp->tlv_data.ipv6_reachs, node, ip6reach))
     {
+      assert (ip6reach->prefix_len <= IPV6_MAX_BITLEN);
+
       dist = cost + ip6reach->metric;
       vtype = (ip6reach->control_info & CTRL_INFO_DISTRIBUTION) ?
         VTYPE_IP6REACH_EXTERNAL : VTYPE_IP6REACH_INTERNAL;