summaryrefslogtreecommitdiff
path: root/sbin/dhclient/options.c
diff options
context:
space:
mode:
authorPeter Hessler <phessler@cvs.openbsd.org>2011-04-17 19:57:24 +0000
committerPeter Hessler <phessler@cvs.openbsd.org>2011-04-17 19:57:24 +0000
commit856c33e01578d9d51c0bef52b76c18dfbe315850 (patch)
treed26b852bc6fe7868aa1d9d06a66145a345b4289c /sbin/dhclient/options.c
parent43aebadfee209863e523b66604e05551ca3f6d08 (diff)
fix a possible division by zero if a server sends us a broken option
hints for the proper fix, and OK claudio@ (this was lost in my tree for far too long)
Diffstat (limited to 'sbin/dhclient/options.c')
-rw-r--r--sbin/dhclient/options.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sbin/dhclient/options.c b/sbin/dhclient/options.c
index 94dd2052f1f..c4007fe57a1 100644
--- a/sbin/dhclient/options.c
+++ b/sbin/dhclient/options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: options.c,v 1.37 2009/03/10 23:19:36 krw Exp $ */
+/* $OpenBSD: options.c,v 1.38 2011/04/17 19:57:23 phessler Exp $ */
/* DHCP options parsing and reassembly. */
@@ -212,6 +212,13 @@ pretty_print_option(unsigned int code, unsigned char *data, int len,
--numelem;
fmtbuf[i] = 0;
numhunk = 0;
+ if (hunksize == 0) {
+ warning("%s: no size indicator before A"
+ " in format string: %s",
+ dhcp_options[code].name,
+ dhcp_options[code].format);
+ return ("<fmt error>");
+ }
break;
case 'X':
for (k = 0; k < len; k++)