]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix a memory issue.
authorRoy Marples <roy@marples.name>
Thu, 3 Aug 2017 19:22:19 +0000 (20:22 +0100)
committerRoy Marples <roy@marples.name>
Thu, 3 Aug 2017 19:22:19 +0000 (20:22 +0100)
src/ipv6nd.c
src/ipv6nd.h

index 0884c9abe76149ca5edbf9145a1796b6585248c6..b7408e9ddba39c9d06b2900ebece9971dcdd5f93 100644 (file)
@@ -246,16 +246,16 @@ ipv6nd_makersprobe(struct interface *ifp)
        state->rs = calloc(1, state->rslen);
        if (state->rs == NULL)
                return -1;
-       rs = (void *)state->rs;
+       rs = state->rs;
        rs->nd_rs_type = ND_ROUTER_SOLICIT;
-       rs->nd_rs_code = 0;
-       rs->nd_rs_cksum = 0;
-       rs->nd_rs_reserved = 0;
+       //rs->nd_rs_code = 0;
+       //rs->nd_rs_cksum = 0;
+       //rs->nd_rs_reserved = 0;
 
        if (ifp->hwlen != 0) {
                struct nd_opt_hdr *nd;
 
-               nd = (struct nd_opt_hdr *)(state->rs + sizeof(*rs));
+               nd = (struct nd_opt_hdr *)(state->rs + 1);
                nd->nd_opt_type = ND_OPT_SOURCE_LINKADDR;
                nd->nd_opt_len = (uint8_t)((ROUNDUP8(ifp->hwlen + 2)) >> 3);
                memcpy(nd + 1, ifp->hwaddr, ifp->hwlen);
index 17d6c953a3a961c01d149745f3790936bfe54862..fc7751e7da18c11015a1c6a4bd647185212179ce 100644 (file)
@@ -55,7 +55,7 @@ struct ra {
 TAILQ_HEAD(ra_head, ra);
 
 struct rs_state {
-       unsigned char *rs;
+       struct nd_router_solicit *rs;
        size_t rslen;
        int rsprobes;
 };