diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2012-11-24 18:06:15 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2012-11-24 18:06:15 +0000 |
commit | fcbc6cf70863a4f7958222f71957bceeaa9837db (patch) | |
tree | 888765c58622e4315aadf18e0fe3348dc7ea5f40 /sbin/dhclient/dispatch.c | |
parent | 461be7c56c861c9833802d2830a324e5f06c21a5 (diff) |
Don't segfault if no subnet-mask is provided, or is marked 'ignore'
in dhclient.conf.
Always zero out stack masks rather than using stack garbage when
no subnet-mask is provided.
Diffstat (limited to 'sbin/dhclient/dispatch.c')
-rw-r--r-- | sbin/dhclient/dispatch.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sbin/dhclient/dispatch.c b/sbin/dhclient/dispatch.c index cd73f79d7d1..81e73313717 100644 --- a/sbin/dhclient/dispatch.c +++ b/sbin/dhclient/dispatch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dispatch.c,v 1.66 2012/11/23 15:25:47 krw Exp $ */ +/* $OpenBSD: dispatch.c,v 1.67 2012/11/24 18:06:14 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -358,8 +358,9 @@ subnet_exists(struct client_lease *l) struct in_addr mymask, myaddr, mynet, hismask, hisaddr, hisnet; int myrdomain, hisrdomain; + memset(&mymask, 0, sizeof(mymask)); memcpy(&mymask.s_addr, l->options[DHO_SUBNET_MASK].data, - sizeof(in_addr_t)); + l->options[DHO_SUBNET_MASK].len); myaddr.s_addr = l->address.s_addr; mynet.s_addr = mymask.s_addr & myaddr.s_addr; |