]> git.decadent.org.uk Git - odhcp6c.git/commitdiff
Fix several incorrect array indices
authorSteven Barth <steven@midlink.org>
Mon, 18 Mar 2013 08:21:53 +0000 (09:21 +0100)
committerSteven Barth <steven@midlink.org>
Mon, 18 Mar 2013 08:21:53 +0000 (09:21 +0100)
* fixes preference handling
* fixes custom client IDs

src/dhcpv6.c
src/odhcp6c.c

index da920ce21c06aa405feee11652f7317502d1a5a2..e99195840f96ed5a7474f01f35dc288ba9c42f07 100644 (file)
@@ -520,7 +520,7 @@ static int dhcpv6_handle_advert(_unused enum dhcpv6_msg orig,
                        cand.preference -= 2000;
                } else if (otype == DHCPV6_OPT_PREF && olen >= 1 &&
                                cand.preference >= 0) {
-                       cand.preference = odata[1];
+                       cand.preference = odata[0];
                } else if (otype == DHCPV6_OPT_RECONF_ACCEPT) {
                        cand.wants_reconfigure = true;
                } else if (otype == DHCPV6_OPT_IA_PD && request_prefix) {
index 50404afe85ec519c326eeef6e0b862ebb4fda2e1..f4f83f1efb846cbb2250c0827763b144d5ad365a 100644 (file)
@@ -89,7 +89,7 @@ int main(_unused int argc, char* const argv[])
                                buf[0] = 0;
                                buf[1] = DHCPV6_OPT_CLIENTID;
                                buf[2] = 0;
-                               buf[4] = l;
+                               buf[3] = l;
                                odhcp6c_add_state(STATE_CLIENT_ID, buf, l + 4);
                        } else {
                                help = true;