summaryrefslogtreecommitdiff
path: root/sbin/dhclient
diff options
context:
space:
mode:
authorPeter Valchev <pvalchev@cvs.openbsd.org>2007-05-31 23:24:16 +0000
committerPeter Valchev <pvalchev@cvs.openbsd.org>2007-05-31 23:24:16 +0000
commit04885bf9ba912ab184c4a415f731af6f4d66a522 (patch)
treef353618af2418a8d97911c12c1747f1cea436853 /sbin/dhclient
parented2b21c65f1d8636724af0bebeb13573c45e2c46 (diff)
fix a funny memory miscalculation bug in options parsing
ok henning otto theo
Diffstat (limited to 'sbin/dhclient')
-rw-r--r--sbin/dhclient/options.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sbin/dhclient/options.c b/sbin/dhclient/options.c
index 03480881f3b..2e3372babf2 100644
--- a/sbin/dhclient/options.c
+++ b/sbin/dhclient/options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: options.c,v 1.34 2007/02/14 23:19:26 deraadt Exp $ */
+/* $OpenBSD: options.c,v 1.35 2007/05/31 23:24:15 pvalchev Exp $ */
/* DHCP options parsing and reassembly. */
@@ -285,6 +285,7 @@ pretty_print_option(unsigned int code, unsigned char *data, int len,
for (i = 0; i < numhunk; i++) {
for (j = 0; j < numelem; j++) {
int opcount;
+ size_t oplen;
switch (fmtbuf[j]) {
case 't':
if (emit_quotes) {
@@ -390,8 +391,9 @@ pretty_print_option(unsigned int code, unsigned char *data, int len,
default:
warning("Unexpected format code %c", fmtbuf[j]);
}
- op += strlen(op);
- opleft -= strlen(op);
+ oplen = strlen(op);
+ op += oplen;
+ opleft -= oplen;
if (opleft < 1)
goto toobig;
if (j + 1 < numelem && comma != ':') {