Make sure that received DHCP packets have a valid options end marker.

This commit is contained in:
Nicholas J. Kain 2015-01-06 04:02:52 -05:00
parent 94c107d465
commit c8dcf5a06b

View File

@ -338,6 +338,11 @@ static int validate_dhcp_packet(struct client_state_t *cs, size_t len,
client_config.arp[4], client_config.arp[5]);
return 0;
}
ssize_t endloc = get_end_option_idx(packet);
if (endloc < 0) {
log_warning("%s: Packet does not have an end option. Ignoring.");
return 0;
}
*msgtype = get_option_msgtype(packet);
if (!*msgtype) {
log_warning("%s: Packet does not specify a DHCP message type. Ignoring.",