summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjsing <>2020-10-11 02:59:47 +0000
committerjsing <>2020-10-11 02:59:47 +0000
commitf66875f2b621714e5cf7553842e67fefa1b1b1c7 (patch)
tree4bad59e8c3e7a88d2e93db22aca0c7f1c81c0c6c /src
parent834a06c9fb3367c3f4dddb2394cb4b30a1148ccc (diff)
downloadopenbsd-f66875f2b621714e5cf7553842e67fefa1b1b1c7.tar.gz
openbsd-f66875f2b621714e5cf7553842e67fefa1b1b1c7.tar.bz2
openbsd-f66875f2b621714e5cf7553842e67fefa1b1b1c7.zip
Grow init_buf before stashing a handshake message for the legacy stack.
When transitioning from the TLSv1.3 stack to the legacy stack, grow init_buf before stashing the handshake message. The TLSv1.3 stack has already received the handshake message (potentially from multiple TLS records) and validated its size, however the default allocation is only for a single plaintext record, which can result in the handshake message failing to fit in certain cases. Issue noted by tb@ via tlsfuzzer. ok tb@
Diffstat (limited to 'src')
-rw-r--r--src/lib/libssl/tls13_legacy.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/libssl/tls13_legacy.c b/src/lib/libssl/tls13_legacy.c
index 943e2db9a1..a9a7fff3e0 100644
--- a/src/lib/libssl/tls13_legacy.c
+++ b/src/lib/libssl/tls13_legacy.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_legacy.c,v 1.16 2020/10/11 02:22:27 jsing Exp $ */ 1/* $OpenBSD: tls13_legacy.c,v 1.17 2020/10/11 02:59:47 jsing 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 *
@@ -340,6 +340,8 @@ tls13_use_legacy_stack(struct tls13_ctx *ctx)
340 340
341 /* Stash the current handshake message. */ 341 /* Stash the current handshake message. */
342 tls13_handshake_msg_data(ctx->hs_msg, &cbs); 342 tls13_handshake_msg_data(ctx->hs_msg, &cbs);
343 if (!BUF_MEM_grow_clean(s->internal->init_buf, CBS_len(&cbs)))
344 goto err;
343 if (!CBS_write_bytes(&cbs, s->internal->init_buf->data, 345 if (!CBS_write_bytes(&cbs, s->internal->init_buf->data,
344 s->internal->init_buf->length, NULL)) 346 s->internal->init_buf->length, NULL))
345 goto err; 347 goto err;