[quagga-dev,15554,03/16] bgpd: check return value of zebra_interface_state_read

Message ID 1465927630-27768-3-git-send-email-chris@opensourcerouting.org
State Under Review
Headers show
Series
  • [quagga-dev,15552,01/16] zebra: fix null pointer dereference in zsend_ipv4_nexthop_lookup_mrib
Related show

Commit Message

Christian Franke June 14, 2016, 6:06 p.m.
From: Christian Franke <nobody@nowhere.ws>

zebra_interface_state_read can return NULL in cornercases. The other
daemons check for this, so should bgpd.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
---
 bgpd/bgp_zebra.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Donald Sharp June 15, 2016, 12:30 p.m. | #1
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>

One thing I would like to start thinking about is fixing the semantics of
the zapi such that client protocols don't have to worry about parsing the
stream data.  It should be handled by the lib/zclient.c and calling the
appropriate lib/*.c functions to announce new information.  This would
reduce the cut-n-paste decoding that is done by every client protocol.

donald

On Tue, Jun 14, 2016 at 2:06 PM, Christian Franke <
chris@opensourcerouting.org> wrote:

> From: Christian Franke <nobody@nowhere.ws>
>
> zebra_interface_state_read can return NULL in cornercases. The other
> daemons check for this, so should bgpd.
>
> Signed-off-by: Christian Franke <chris@opensourcerouting.org>
> ---
>  bgpd/bgp_zebra.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
> index d0b9216..a1f42f9 100644
> --- a/bgpd/bgp_zebra.c
> +++ b/bgpd/bgp_zebra.c
> @@ -100,6 +100,9 @@ bgp_interface_delete (int command, struct zclient
> *zclient,
>
>    s = zclient->ibuf;
>    ifp = zebra_interface_state_read (s, vrf_id);
> +  if (! ifp)
> +    return 0;
> +
>    ifp->ifindex = IFINDEX_INTERNAL;
>
>    if (BGP_DEBUG(zebra, ZEBRA))
> --
> 2.8.0
>
>
> _______________________________________________
> Quagga-dev mailing list
> Quagga-dev@lists.quagga.net
> https://lists.quagga.net/mailman/listinfo/quagga-dev
>

Patch hide | download patch | download mbox

diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index d0b9216..a1f42f9 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -100,6 +100,9 @@  bgp_interface_delete (int command, struct zclient *zclient,
 
   s = zclient->ibuf;
   ifp = zebra_interface_state_read (s, vrf_id);
+  if (! ifp)
+    return 0;
+
   ifp->ifindex = IFINDEX_INTERNAL;
 
   if (BGP_DEBUG(zebra, ZEBRA))