weren't removed from the DNS.
[ISC-BUGS #27858]
+- Use offsetof() instead of sizeof() to get the sizes for dhcpv6_relay_packet
+ and dhcpv6_packet in several more places. Thanks to a report from
+ Bruno Verstuyft and Vincent Demaertelaere of Excentis.
+ [ISC-Bugs #27941]
+
Changes since 4.2.2
- Fix the code that checks for an existing DDNS transaction to cancel
msg_type = packet[0];
if ((msg_type == DHCPV6_RELAY_FORW) ||
(msg_type == DHCPV6_RELAY_REPL)) {
+ int relaylen = (int)(offsetof(struct dhcpv6_relay_packet, options));
relay = (const struct dhcpv6_relay_packet *)packet;
decoded_packet->dhcpv6_msg_type = relay->msg_type;
relay->peer_address, sizeof(relay->peer_address));
if (!parse_option_buffer(decoded_packet->options,
- relay->options, len-sizeof(*relay),
+ relay->options, len - relaylen,
&dhcpv6_universe)) {
/* no logging here, as parse_option_buffer() logs all
cases where it fails */
return;
}
} else {
+ int msglen = (int)(offsetof(struct dhcpv6_packet, options));
msg = (const struct dhcpv6_packet *)packet;
decoded_packet->dhcpv6_msg_type = msg->msg_type;
sizeof(decoded_packet->dhcpv6_transaction_id));
if (!parse_option_buffer(decoded_packet->options,
- msg->options, len-sizeof(*msg),
+ msg->options, len - msglen,
&dhcpv6_universe)) {
/* no logging here, as parse_option_buffer() logs all
cases where it fails */
msg_type = enc_opt_data.data[0];
if ((msg_type == DHCPV6_RELAY_FORW) ||
(msg_type == DHCPV6_RELAY_REPL)) {
+ int relaylen = (int)(offsetof(struct dhcpv6_relay_packet, options));
relay = (struct dhcpv6_relay_packet *)enc_opt_data.data;
enc_packet->dhcpv6_msg_type = relay->msg_type;
if (!parse_option_buffer(enc_packet->options,
relay->options,
- enc_opt_data.len-sizeof(*relay),
+ enc_opt_data.len - relaylen,
&dhcpv6_universe)) {
/* no logging here, as parse_option_buffer() logs all
cases where it fails */
goto exit;
}
} else {
+ int msglen = (int)(offsetof(struct dhcpv6_packet, options));
msg = (struct dhcpv6_packet *)enc_opt_data.data;
enc_packet->dhcpv6_msg_type = msg->msg_type;
if (!parse_option_buffer(enc_packet->options,
msg->options,
- enc_opt_data.len-sizeof(*msg),
+ enc_opt_data.len - msglen,
&dhcpv6_universe)) {
/* no logging here, as parse_option_buffer() logs all
cases where it fails */