bgpd: null check (Coverity 23106)

Signed-off-by: F. Aragon <paco@voltanet.io>
This commit is contained in:
paco 2018-06-21 15:58:51 +02:00
parent eab268594a
commit e8a3a0a030
No known key found for this signature in database
GPG Key ID: FD112A8C7E6A5E4A
2 changed files with 4 additions and 1 deletions

View File

@ -1632,7 +1632,7 @@ struct aspath *aspath_reconcile_as4(struct aspath *aspath,
struct aspath *newpath = NULL, *mergedpath;
int hops, cpasns = 0;
if (!aspath)
if (!aspath || !as4path)
return NULL;
seg = aspath->segments;

View File

@ -1513,6 +1513,9 @@ bgp_attr_munge_as4_attrs(struct peer *const peer, struct attr *const attr,
if (!ignore_as4_path
&& (attr->flag & (ATTR_FLAG_BIT(BGP_ATTR_AS4_PATH)))) {
newpath = aspath_reconcile_as4(attr->aspath, as4_path);
if (!newpath)
return BGP_ATTR_PARSE_ERROR;
aspath_unintern(&attr->aspath);
attr->aspath = aspath_intern(newpath);
}