From c28e5b2a83732c8b235c6b7d4ce64fc2c449d939 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 1 Feb 2017 19:43:43 -0500 Subject: [PATCH] lib: Fix SA issue with stream s read We were checking for non-null of 'struct stream *s' after we did a stream_getl, which would have crashed the program. Signed-off-by: Donald Sharp --- lib/zclient.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/zclient.c b/lib/zclient.c index 92662fd70f..cea4b098fc 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -1146,11 +1146,15 @@ struct interface * zebra_interface_link_params_read (struct stream *s) { struct if_link_params *iflp; - uint32_t ifindex = stream_getl (s); + ifindex_t ifindex; + + assert (s); + + ifindex = stream_getl (s); struct interface *ifp = if_lookup_by_index (ifindex); - if (ifp == NULL || s == NULL) + if (ifp == NULL) { zlog_err ("%s: unknown ifindex %u, shouldn't happen", __func__, ifindex); -- 2.39.5