diff options
author | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2022-07-06 12:52:17 +0200 |
---|---|---|
committer | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2022-07-06 12:52:17 +0200 |
commit | f14233edbded0f2acccdf491b2173debd5c836e6 (patch) | |
tree | 1e55797022b466f2da63b8a54e873ff50c3f69d3 /bfdd | |
parent | bfdd: fix coverity scan resource leak (diff) | |
download | frr-f14233edbded0f2acccdf491b2173debd5c836e6.tar.xz frr-f14233edbded0f2acccdf491b2173debd5c836e6.zip |
bfdd: fix coverity memory overrun
Use the destination for the operator `sizeof()` instead of the source
which could (and is) be bigger than destination.
We are not truncating any data here it just happens that the zebra
interface data structure hardware address can be bigger due to different
types of interface.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Diffstat (limited to 'bfdd')
-rw-r--r-- | bfdd/bfd_packet.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bfdd/bfd_packet.c b/bfdd/bfd_packet.c index 23778c82d..d34d64276 100644 --- a/bfdd/bfd_packet.c +++ b/bfdd/bfd_packet.c @@ -219,8 +219,8 @@ void ptm_bfd_echo_fp_snd(struct bfd_session *bfd) /* add eth hdr */ eth = (struct ethhdr *)(sendbuff); - memcpy(eth->h_source, bfd->ifp->hw_addr, sizeof(bfd->ifp->hw_addr)); - memcpy(eth->h_dest, bfd->peer_hw_addr, sizeof(bfd->peer_hw_addr)); + memcpy(eth->h_source, bfd->ifp->hw_addr, sizeof(eth->h_source)); + memcpy(eth->h_dest, bfd->peer_hw_addr, sizeof(eth->h_dest)); total_len += sizeof(struct ethhdr); |