From 31e39503c5d64018367bf82b509bbabd0fb51101 Mon Sep 17 00:00:00 2001 From: thorpej Date: Mon, 1 Mar 2004 18:33:03 +0000 Subject: [PATCH] Merge netkey/key.c rev 1.51 (wiz): va_{start,end} audit: Make sure that each va_start has one and only one matching va_end, especially in error cases. If the va_list is used multiple times, do multiple va_starts/va_ends. If a function gets va_list as argument, don't let it use va_end (since it's the callers responsibility). Improved by comments from enami and christos -- thanks! Heimdal/krb4/KAME changes already fed back, rest to follow. Inspired by, but not not based on, OpenBSD. --- sys/netipsec/key.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/netipsec/key.c b/sys/netipsec/key.c index 33916c33967f..3c25fab262d1 100644 --- a/sys/netipsec/key.c +++ b/sys/netipsec/key.c @@ -1,4 +1,4 @@ -/* $NetBSD: key.c,v 1.7 2004/02/24 15:12:52 wiz Exp $ */ +/* $NetBSD: key.c,v 1.8 2004/03/01 18:33:03 thorpej Exp $ */ /* $FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/netipsec/key.c,v 1.3.2.2 2003/07/01 01:38:13 sam Exp $ */ /* $KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $ */ @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.7 2004/02/24 15:12:52 wiz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.8 2004/03/01 18:33:03 thorpej Exp $"); /* * This code is referd to RFC 2367 @@ -1681,6 +1681,7 @@ key_gather_mbuf(m, mhp, ndeep, nitem, va_alist) return result; fail: + va_end(ap); m_freem(result); return NULL; }