From 04885bf9ba912ab184c4a415f731af6f4d66a522 Mon Sep 17 00:00:00 2001 From: Peter Valchev Date: Thu, 31 May 2007 23:24:16 +0000 Subject: fix a funny memory miscalculation bug in options parsing ok henning otto theo --- sbin/dhclient/options.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'sbin/dhclient') 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 != ':') { -- cgit v1.2.3