From a1039563ca663d0037e7b06f60291f0edd48d670 Mon Sep 17 00:00:00 2001 From: Cedric Berger Date: Thu, 6 Mar 2003 13:48:19 +0000 Subject: "len" is decremented too early, so the second argument of the snprintf call is too small on last run of the loop. ok ho@ --- sbin/isakmpd/field.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sbin/isakmpd') diff --git a/sbin/isakmpd/field.c b/sbin/isakmpd/field.c index 4072945a57e..4e8d4b97cf0 100644 --- a/sbin/isakmpd/field.c +++ b/sbin/isakmpd/field.c @@ -1,4 +1,4 @@ -/* $OpenBSD: field.c,v 1.10 2002/01/23 18:44:47 ho Exp $ */ +/* $OpenBSD: field.c,v 1.11 2003/03/06 13:48:18 cedric Exp $ */ /* $EOM: field.c,v 1.11 2000/02/20 19:58:37 niklas Exp $ */ /* @@ -76,7 +76,7 @@ field_debug_raw (u_int8_t *buf, size_t len, struct constant_map **maps) return 0; strlcpy (retval, "0x", 3 + len * 2); p = retval + 2; - while (len--) + for(; len > 0; len--) { snprintf (p, 1 + len * 2, "%02x", *buf++); p += 2; -- cgit v1.2.3