diff options
Diffstat (limited to 'sbin/dhclient/dhclient.c')
-rw-r--r-- | sbin/dhclient/dhclient.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index c295b08feb7..58d25da9a46 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.173 2012/11/14 15:47:41 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.174 2012/11/14 18:09:01 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -662,13 +662,14 @@ bind_lease(void) lease = apply_defaults(client->new); options = lease->options; - memcpy(&mask.s_addr, options[DHO_SUBNET_MASK].data, sizeof(in_addr_t)); + memcpy(&mask.s_addr, options[DHO_SUBNET_MASK].data, + options[DHO_SUBNET_MASK].len); add_address(ifi->name, ifi->rdomain, client->new->address, mask); if (options[DHO_ROUTERS].len) { memset(&gateway, 0, sizeof(gateway)); /* XXX Only use FIRST router address for now. */ memcpy(&gateway.s_addr, options[DHO_ROUTERS].data, - sizeof(in_addr_t)); + options[DHO_ROUTERS].len); add_default_route(ifi->rdomain, client->new->address, gateway); } if (options[DHO_DOMAIN_NAME].len) @@ -724,7 +725,7 @@ state_bound(void) if (client->active->options[DHO_DHCP_SERVER_IDENTIFIER].len == 4) { memcpy(&client->destination.s_addr, client->active->options[DHO_DHCP_SERVER_IDENTIFIER].data, - sizeof(in_addr_t)); + client->active->options[DHO_DHCP_SERVER_IDENTIFIER].len)); } else client->destination.s_addr = INADDR_BROADCAST; |