summaryrefslogtreecommitdiffstats
path: root/lib/libssl/tls12_record_layer.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2021-01-07 15:37:19 +0000
committerjsing <jsing@openbsd.org>2021-01-07 15:37:19 +0000
commit3e9ce141db9002f66e7bd14c995328dae6340de3 (patch)
tree0a9a1fb9900f699aa207faebd3a510d54dd0e857 /lib/libssl/tls12_record_layer.c
parentMove the read MAC key into the TLSv1.2 record layer. (diff)
downloadwireguard-openbsd-3e9ce141db9002f66e7bd14c995328dae6340de3.tar.xz
wireguard-openbsd-3e9ce141db9002f66e7bd14c995328dae6340de3.zip
Make tls12_record_layer_free() NULL safe.
This is not an issue currently, but avoids future surprises. Noted by tb@
Diffstat (limited to 'lib/libssl/tls12_record_layer.c')
-rw-r--r--lib/libssl/tls12_record_layer.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libssl/tls12_record_layer.c b/lib/libssl/tls12_record_layer.c
index 32e3fcc8139..600b73987e1 100644
--- a/lib/libssl/tls12_record_layer.c
+++ b/lib/libssl/tls12_record_layer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tls12_record_layer.c,v 1.6 2021/01/07 15:32:59 jsing Exp $ */
+/* $OpenBSD: tls12_record_layer.c,v 1.7 2021/01/07 15:37:19 jsing Exp $ */
/*
* Copyright (c) 2020 Joel Sing <jsing@openbsd.org>
*
@@ -66,7 +66,11 @@ tls12_record_layer_new(void)
void
tls12_record_layer_free(struct tls12_record_layer *rl)
{
+ if (rl == NULL)
+ return;
+
freezero(rl->read_mac_key, rl->read_mac_key_len);
+
freezero(rl, sizeof(struct tls12_record_layer));
}