summaryrefslogtreecommitdiff
path: root/sbin/dhclient/dispatch.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2012-11-24 18:06:15 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2012-11-24 18:06:15 +0000
commitfcbc6cf70863a4f7958222f71957bceeaa9837db (patch)
tree888765c58622e4315aadf18e0fe3348dc7ea5f40 /sbin/dhclient/dispatch.c
parent461be7c56c861c9833802d2830a324e5f06c21a5 (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.c5
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;