summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2005-07-15 22:33:04 +0000
committerkrw <krw@openbsd.org>2005-07-15 22:33:04 +0000
commitcda9d2a7598758dcf34bcc2ac9a663e3daf744f6 (patch)
treef95d4795eba23f2ddbf74c50de67769c2a610588
parentFrom FreeBSD netgraph/bluetooth/include/ng_hci.h rev. 1.5: (diff)
downloadwireguard-openbsd-cda9d2a7598758dcf34bcc2ac9a663e3daf744f6.tar.xz
wireguard-openbsd-cda9d2a7598758dcf34bcc2ac9a663e3daf744f6.zip
Fix handling of comma separated option value lists, broken in r1.20.
Found and fix tested by Moritz Jodeit.
-rw-r--r--sbin/dhclient/clparse.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/sbin/dhclient/clparse.c b/sbin/dhclient/clparse.c
index 6ada6307992..30c990f991d 100644
--- a/sbin/dhclient/clparse.c
+++ b/sbin/dhclient/clparse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clparse.c,v 1.22 2005/07/11 18:24:08 deraadt Exp $ */
+/* $OpenBSD: clparse.c,v 1.23 2005/07/15 22:33:04 krw Exp $ */
/* Parser for dhclient config and lease files... */
@@ -684,12 +684,10 @@ parse_option_decl(FILE *cfile, struct option_data *options)
/* Look up the actual option info. */
fmt = NULL;
for (code=0; code < 256; code++)
- if (strcmp(dhcp_options[code].name, val) == 0) {
- fmt = dhcp_options[code].format;
+ if (strcmp(dhcp_options[code].name, val) == 0)
break;
- }
- if (!fmt) {
+ if (code > 255) {
parse_warn("no option named %s", val);
skip_to_semi(cfile);
return (NULL);
@@ -697,7 +695,7 @@ parse_option_decl(FILE *cfile, struct option_data *options)
/* Parse the option data... */
do {
- for (; *fmt; fmt++) {
+ for (fmt = dhcp_options[code].format; *fmt; fmt++) {
if (*fmt == 'A')
break;
switch (*fmt) {