]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix some potential memory errors.
authorRoy Marples <roy@marples.name>
Wed, 30 Apr 2014 10:02:20 +0000 (10:02 +0000)
committerRoy Marples <roy@marples.name>
Wed, 30 Apr 2014 10:02:20 +0000 (10:02 +0000)
if-bsd.c

index 74d7bbedb6b6884ae1b6fd453d02cba4d20c652f..08910d0103d9f302cd0b1ae4763c832f4b22b312 100644 (file)
--- a/if-bsd.c
+++ b/if-bsd.c
@@ -244,6 +244,7 @@ if_openrawsocket(struct interface *ifp, int protocol)
 
        state = D_STATE(ifp);
 
+       memset(&pv, 0, sizeof(pv));
        if (ioctl(fd, BIOCVERSION, &pv) == -1)
                goto eexit;
        if (pv.bv_major != BPF_MAJOR_VERSION ||
@@ -277,6 +278,7 @@ if_openrawsocket(struct interface *ifp, int protocol)
 #endif
 
        /* Install the DHCP filter */
+       memset(&pf, 0, sizeof(pf));
        if (protocol == ETHERTYPE_ARP) {
                pf.bf_insns = UNCONST(arp_bpf_filter);
                pf.bf_len = arp_bpf_filter_len;
@@ -434,7 +436,7 @@ if_route(const struct rt *rt, int action)
        struct rtm
        {
                struct rt_msghdr hdr;
-               char buffer[sizeof(su) * 4];
+               char buffer[sizeof(su) * 5];
        } rtm;
        char *bp = rtm.buffer;
        size_t l;
@@ -588,7 +590,7 @@ if_route6(const struct rt6 *rt, int action)
        struct rtm
        {
                struct rt_msghdr hdr;
-               char buffer[sizeof(su) * 4];
+               char buffer[sizeof(su) * 5];
        } rtm;
        char *bp = rtm.buffer;
        size_t l;