summaryrefslogtreecommitdiff
path: root/bgpd/bgp_flowspec_util.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2020-08-21 08:42:20 +0200
committerPhilippe Guibert <philippe.guibert@6wind.com>2020-08-21 13:37:08 +0200
commitc24ceb896e9b93abd8a3d03ded9a703324c56a11 (patch)
treefc8cfd61d724e6a5c3ec3ceb7fc9c78554612112 /bgpd/bgp_flowspec_util.c
parent4371bf9110261f81edfd457a33f86cb0ce12ada7 (diff)
bgpd: fix Dereference of null pointer in flowspec
a dereference of null pointer exists in current flowspec code, with prefix pointer. check validity of pointer before going ahead. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'bgpd/bgp_flowspec_util.c')
-rw-r--r--bgpd/bgp_flowspec_util.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/bgpd/bgp_flowspec_util.c b/bgpd/bgp_flowspec_util.c
index 0115d7af1e..90e9236385 100644
--- a/bgpd/bgp_flowspec_util.c
+++ b/bgpd/bgp_flowspec_util.c
@@ -228,10 +228,12 @@ int bgp_flowspec_ip_address(enum bgp_flowspec_util_nlri_t type,
BGP_FLOWSPEC_STRING_DISPLAY_MAX);
break;
case BGP_FLOWSPEC_CONVERT_TO_NON_OPAQUE:
- if (prefix_local.family == AF_INET)
- PREFIX_COPY_IPV4(prefix, &prefix_local)
- else
- PREFIX_COPY_IPV6(prefix, &prefix_local)
+ if (prefix) {
+ if (prefix_local.family == AF_INET)
+ PREFIX_COPY_IPV4(prefix, &prefix_local)
+ else
+ PREFIX_COPY_IPV6(prefix, &prefix_local)
+ }
break;
case BGP_FLOWSPEC_VALIDATE_ONLY:
default: