From: Steven Barth Date: Mon, 18 Mar 2013 08:21:53 +0000 (+0100) Subject: Fix several incorrect array indices X-Git-Tag: debian/1.1+git20160131-1~172 X-Git-Url: https://git.decadent.org.uk/gitweb/?p=odhcp6c.git;a=commitdiff_plain;h=82e0235c10dda8b9baeb06b6383bec1f43bb61a2 Fix several incorrect array indices * fixes preference handling * fixes custom client IDs --- diff --git a/src/dhcpv6.c b/src/dhcpv6.c index da920ce..e991958 100644 --- a/src/dhcpv6.c +++ b/src/dhcpv6.c @@ -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) { diff --git a/src/odhcp6c.c b/src/odhcp6c.c index 50404af..f4f83f1 100644 --- a/src/odhcp6c.c +++ b/src/odhcp6c.c @@ -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;