summaryrefslogtreecommitdiffstats
path: root/ripd
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2022-05-11 12:14:01 +0200
committerDonatas Abraitis <donatas@opensourcerouting.org>2022-05-11 13:08:46 +0200
commitf51eeb864bc821d92bd8e95670dde1258ed0747c (patch)
treecbf6b7eb9bf167fb004324595ae8ae4e76e8d4a2 /ripd
parenttools: Add coccinelle script to catch memset/memcpy wrong usage (diff)
downloadfrr-f51eeb864bc821d92bd8e95670dde1258ed0747c.tar.xz
frr-f51eeb864bc821d92bd8e95670dde1258ed0747c.zip
ripd: Use correct usage of memcpy() when zeroing struct
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'ripd')
-rw-r--r--ripd/ripd.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/ripd/ripd.c b/ripd/ripd.c
index 2a05f30bc..74a06b689 100644
--- a/ripd/ripd.c
+++ b/ripd/ripd.c
@@ -1287,10 +1287,9 @@ static void rip_response_process(struct rip_packet *packet, int size,
uint32_t destination;
if (subnetted == -1) {
- memcpy(&ifaddr, ifc->address,
- sizeof(struct prefix_ipv4));
+ memcpy(&ifaddr, ifc->address, sizeof(ifaddr));
memcpy(&ifaddrclass, &ifaddr,
- sizeof(struct prefix_ipv4));
+ sizeof(ifaddrclass));
apply_classful_mask_ipv4(&ifaddrclass);
subnetted = 0;
if (ifaddr.prefixlen > ifaddrclass.prefixlen)
@@ -2103,7 +2102,7 @@ void rip_output_process(struct connected *ifc, struct sockaddr_in *to,
}
if (version == RIPv1) {
- memcpy(&ifaddrclass, ifc->address, sizeof(struct prefix_ipv4));
+ memcpy(&ifaddrclass, ifc->address, sizeof(ifaddrclass));
apply_classful_mask_ipv4(&ifaddrclass);
subnetted = 0;
if (ifc->address->prefixlen > ifaddrclass.prefixlen)