diff options
author | jsing <> | 2020-08-11 19:25:40 +0000 |
---|---|---|
committer | jsing <> | 2020-08-11 19:25:40 +0000 |
commit | 2128dab3e544b255acfd4d5fbd95244a053dd361 (patch) | |
tree | b11c263634fd6fb2f54edcf91e22ea3d0c77b354 /src | |
parent | d230ee9311d084ffdf26d4c970e7b5dade552eb4 (diff) | |
download | openbsd-2128dab3e544b255acfd4d5fbd95244a053dd361.tar.gz openbsd-2128dab3e544b255acfd4d5fbd95244a053dd361.tar.bz2 openbsd-2128dab3e544b255acfd4d5fbd95244a053dd361.zip |
Send an unexpected message alert if no valid content type is found.
When record protection is engaged, the plaintext must be followed by a
non-zero content type and optional zero padding. If the plaintext is zero
length or only consists of zero bytes then it is not a valid message,
since the content type is unspecified.
ok tb@
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libssl/tls13_record_layer.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lib/libssl/tls13_record_layer.c b/src/lib/libssl/tls13_record_layer.c index af4e7f2454..7093da48a7 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.51 2020/08/10 18:54:45 tb Exp $ */ | 1 | /* $OpenBSD: tls13_record_layer.c,v 1.52 2020/08/11 19:25:40 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 | * |
@@ -576,8 +576,11 @@ tls13_record_layer_open_record_protected(struct tls13_record_layer *rl) | |||
576 | inner_len = out_len - 1; | 576 | inner_len = out_len - 1; |
577 | while (inner_len >= 0 && content[inner_len] == 0) | 577 | while (inner_len >= 0 && content[inner_len] == 0) |
578 | inner_len--; | 578 | inner_len--; |
579 | if (inner_len < 0) | 579 | if (inner_len < 0) { |
580 | /* Unexpected message per RFC 8446 section 5.4. */ | ||
581 | rl->alert = TLS13_ALERT_UNEXPECTED_MESSAGE; | ||
580 | goto err; | 582 | goto err; |
583 | } | ||
581 | if (inner_len > TLS13_RECORD_MAX_PLAINTEXT_LEN) { | 584 | if (inner_len > TLS13_RECORD_MAX_PLAINTEXT_LEN) { |
582 | rl->alert = SSL_AD_RECORD_OVERFLOW; | 585 | rl->alert = SSL_AD_RECORD_OVERFLOW; |
583 | goto err; | 586 | goto err; |