From: paco Date: Wed, 20 Jun 2018 17:11:18 +0000 (+0200) Subject: bgpd, lib: null check (Coverity 1436344, 1451361) X-Git-Tag: frr-6.1-dev~275^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=fa3016309b33395c02cf10e7e198517c5b81e55a;p=matthieu%2Ffrr.git bgpd, lib: null check (Coverity 1436344, 1451361) Signed-off-by: F. Aragon --- diff --git a/bgpd/bgp_clist.c b/bgpd/bgp_clist.c index 7cf1477549..0ffbe174ed 100644 --- a/bgpd/bgp_clist.c +++ b/bgpd/bgp_clist.c @@ -1054,6 +1054,9 @@ int extcommunity_list_set(struct community_list_handler *ch, const char *name, struct ecommunity *ecom = NULL; regex_t *regex = NULL; + if (str == NULL) + return COMMUNITY_LIST_ERR_MALFORMED_VAL; + entry = NULL; /* Get community list. */ @@ -1089,7 +1092,7 @@ int extcommunity_list_set(struct community_list_handler *ch, const char *name, entry = community_entry_new(); entry->direct = direct; entry->style = style; - entry->any = (str ? 0 : 1); + entry->any = 0; if (ecom) entry->config = ecommunity_ecom2str( ecom, ECOMMUNITY_FORMAT_COMMUNITY_LIST, 0); diff --git a/lib/command_match.c b/lib/command_match.c index 99ec03e0c2..4893ead042 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -609,6 +609,7 @@ static struct list *disambiguate(struct list *first, struct list *second, vector vline, unsigned int n) { // doesn't make sense for these to be inequal length + assert(first && second); assert(first->count == second->count); assert(first->count == vector_active(vline) - n + 1);