Merge pull request #2518 from pacovn/Coverity_23106_Explicit_null_dereferenced

bgpd: null check (Coverity 23106)
This commit is contained in:
Quentin Young 2018-06-21 14:24:11 -04:00 committed by GitHub
commit 277781a778
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);
}