summaryrefslogtreecommitdiff
path: root/sbin/iked/ikev2_pld.c
diff options
context:
space:
mode:
authortobhe <tobhe@cvs.openbsd.org>2020-04-08 20:04:20 +0000
committertobhe <tobhe@cvs.openbsd.org>2020-04-08 20:04:20 +0000
commitfd5d15cab6d9936926337ebb76ea3ce2598790ce (patch)
tree6a09d23c364a6051c2cf1529bd279b382f68b6a8 /sbin/iked/ikev2_pld.c
parent201287c99756a195213b7a8f685b7e6b08c7ba8b (diff)
Prevent multiple ibuf leaks. Clean up on proccess shutdown.
ok markus@
Diffstat (limited to 'sbin/iked/ikev2_pld.c')
-rw-r--r--sbin/iked/ikev2_pld.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sbin/iked/ikev2_pld.c b/sbin/iked/ikev2_pld.c
index f90a94a99bf..b542dfafbba 100644
--- a/sbin/iked/ikev2_pld.c
+++ b/sbin/iked/ikev2_pld.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ikev2_pld.c,v 1.80 2020/04/02 19:44:41 tobhe Exp $ */
+/* $OpenBSD: ikev2_pld.c,v 1.81 2020/04/08 20:04:19 tobhe Exp $ */
/*
* Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
@@ -719,6 +719,7 @@ ikev2_pld_id(struct iked *env, struct ikev2_payload *pld,
return (-1);
if (ikev2_print_id(&idb, idstr, sizeof(idstr)) == -1) {
+ ibuf_release(idb.id_buf);
log_debug("%s: malformed id", __func__);
return (-1);
}
@@ -732,12 +733,14 @@ ikev2_pld_id(struct iked *env, struct ikev2_payload *pld,
if (!((sa->sa_hdr.sh_initiator && payload == IKEV2_PAYLOAD_IDr) ||
(!sa->sa_hdr.sh_initiator && payload == IKEV2_PAYLOAD_IDi))) {
+ ibuf_release(idb.id_buf);
log_debug("%s: unexpected id payload", __func__);
return (0);
}
idp = &msg->msg_parent->msg_id;
if (idp->id_type) {
+ ibuf_release(idb.id_buf);
log_debug("%s: duplicate id payload", __func__);
return (-1);
}