summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2012-11-25 14:56:55 +0000
committerkrw <krw@openbsd.org>2012-11-25 14:56:55 +0000
commited249bc1740d16b8d304885236b966321825c376 (patch)
treeccc3dfb817d4991bee0229996fa11f37b832cd10
parentRecognize a wrong network configuration which would cause tftpboot to (diff)
downloadwireguard-openbsd-ed249bc1740d16b8d304885236b966321825c376.tar.xz
wireguard-openbsd-ed249bc1740d16b8d304885236b966321825c376.zip
Clean up parsing of option lists. Part 2.
DHO_PAD ("pad") and DHO_END ("option-end") are not really options and it makes no sense to require, request, or ignore them. And probably would confuse some sensitive dhcp servers.
-rw-r--r--sbin/dhclient/clparse.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sbin/dhclient/clparse.c b/sbin/dhclient/clparse.c
index b5bab51e424..305f2ffb259 100644
--- a/sbin/dhclient/clparse.c
+++ b/sbin/dhclient/clparse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clparse.c,v 1.44 2012/11/25 12:49:56 krw Exp $ */
+/* $OpenBSD: clparse.c,v 1.45 2012/11/25 14:56:55 krw Exp $ */
/* Parser for dhclient config and lease files... */
@@ -312,11 +312,16 @@ parse_option_list(FILE *cfile, u_int8_t *list, size_t sz)
skip_to_semi(cfile);
return (0);
}
- for (i = 0; i < 256; i++)
+ /*
+ * 0 (DHO_PAD) and 255 (DHO_END) are not valid in option
+ * lists. They are not really options and it makes no sense
+ * to request, require or ignore them.
+ */
+ for (i = 1; i < DHO_END; i++)
if (!strcasecmp(dhcp_options[i].name, val))
break;
- if (i == 256) {
+ if (i == DHO_END) {
parse_warn("%s: unexpected option name.", val);
skip_to_semi(cfile);
return (0);