summaryrefslogtreecommitdiffstats
path: root/bfdd/bfd_packet.c
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2020-11-05 17:46:27 +0100
committerIgor Ryzhov <iryzhov@nfware.com>2020-11-05 17:46:27 +0100
commit1db60b576b0c25dd72d6c6f553fac0ea3b610efc (patch)
treec785bb6c40b05e06c5a20110d2f2b5a89af62f83 /bfdd/bfd_packet.c
parentMerge pull request #7427 from mjstapp/dplane_intf_info (diff)
downloadfrr-1db60b576b0c25dd72d6c6f553fac0ea3b610efc.tar.xz
frr-1db60b576b0c25dd72d6c6f553fac0ea3b610efc.zip
bfdd: fix possible null dereference
bs->ifp may be null, so we should check it before dereferencing. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to '')
-rw-r--r--bfdd/bfd_packet.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bfdd/bfd_packet.c b/bfdd/bfd_packet.c
index 5cc47d5a4..0a71c18a4 100644
--- a/bfdd/bfd_packet.c
+++ b/bfdd/bfd_packet.c
@@ -80,7 +80,7 @@ int _ptm_bfd_send(struct bfd_session *bs, uint16_t *port, const void *data,
memset(&sin6, 0, sizeof(sin6));
sin6.sin6_family = AF_INET6;
memcpy(&sin6.sin6_addr, &bs->key.peer, sizeof(sin6.sin6_addr));
- if (IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr))
+ if (bs->ifp && IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr))
sin6.sin6_scope_id = bs->ifp->ifindex;
sin6.sin6_port =
@@ -1051,7 +1051,7 @@ int bp_peer_socketv6(const struct bfd_session *bs)
sin6.sin6_len = sizeof(sin6);
#endif /* HAVE_STRUCT_SOCKADDR_SA_LEN */
memcpy(&sin6.sin6_addr, &bs->key.local, sizeof(sin6.sin6_addr));
- if (IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr))
+ if (bs->ifp && IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr))
sin6.sin6_scope_id = bs->ifp->ifindex;
pcount = 0;