diff options
author | tb <> | 2021-01-02 18:00:08 +0000 |
---|---|---|
committer | tb <> | 2021-01-02 18:00:08 +0000 |
commit | 55d8fce6872caffa61978d1827458d2f852e9b63 (patch) | |
tree | c16eb996c75791191881c35f76b19c3aed6a50c2 /src | |
parent | 985a2a93ea9fc4c44149749be05ba03369762954 (diff) | |
download | openbsd-55d8fce6872caffa61978d1827458d2f852e9b63.tar.gz openbsd-55d8fce6872caffa61978d1827458d2f852e9b63.tar.bz2 openbsd-55d8fce6872caffa61978d1827458d2f852e9b63.zip |
Free {alert,phh}_data in tls13_record_layer_free()
httpd(8)'s incorrect tls_close() after closing the underlying socket
led to a leak: tls_close()'s attempt to send out the close_notify won't
work very well over a closed pipe. This resulted in alert_data still
hanging off the TLSv1.3 context's record layer struct. The tls_free()
call should have cleaned this up but failed to do so.
The record layer's phh_data potentially has the same issue, so free it
as well. This diff makes -current httpd(8) run in constant memory over
hundreds of thousands TLS connections with a static site.
ok inoguchi jsing
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libssl/tls13_record_layer.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/libssl/tls13_record_layer.c b/src/lib/libssl/tls13_record_layer.c index 1298f59051..2f980ab60b 100644 --- a/src/lib/libssl/tls13_record_layer.c +++ b/src/lib/libssl/tls13_record_layer.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls13_record_layer.c,v 1.55 2020/10/15 07:07:09 tb Exp $ */ | 1 | /* $OpenBSD: tls13_record_layer.c,v 1.56 2021/01/02 18:00:08 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -135,6 +135,9 @@ tls13_record_layer_free(struct tls13_record_layer *rl) | |||
135 | if (rl == NULL) | 135 | if (rl == NULL) |
136 | return; | 136 | return; |
137 | 137 | ||
138 | freezero(rl->alert_data, rl->alert_len); | ||
139 | freezero(rl->phh_data, rl->phh_len); | ||
140 | |||
138 | tls13_record_layer_rbuf_free(rl); | 141 | tls13_record_layer_rbuf_free(rl); |
139 | 142 | ||
140 | tls13_record_layer_rrec_free(rl); | 143 | tls13_record_layer_rrec_free(rl); |