summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@users.noreply.github.com>2018-06-21 14:24:11 -0400
committerGitHub <noreply@github.com>2018-06-21 14:24:11 -0400
commit277781a7785a125220e4799c41874f15e335103a (patch)
tree5e45633d54a48c5e5d285143592f1c6c34c792d9
parentdfc5d40e91f9418ff5d3159b0cd6621ecad8ea9f (diff)
parente8a3a0a030b07513119a00cc79a304379d3a6e58 (diff)
Merge pull request #2518 from pacovn/Coverity_23106_Explicit_null_dereferenced
bgpd: null check (Coverity 23106)
-rw-r--r--bgpd/bgp_aspath.c2
-rw-r--r--bgpd/bgp_attr.c3
2 files changed, 4 insertions, 1 deletions
diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c
index e02617691f..05e67baa8a 100644
--- a/bgpd/bgp_aspath.c
+++ b/bgpd/bgp_aspath.c
@@ -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;
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index 2c52b57b36..6596e7cfa2 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -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);
}