summaryrefslogtreecommitdiffstats
path: root/ssl/quic/quic_rx_depack.c
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2023-06-06 16:25:10 +0100
committerPauli <pauli@openssl.org>2023-07-17 08:17:57 +1000
commit6c1d0e28650164d782909abfea92ba834d0babd5 (patch)
tree9cd43d390aca59a89114111a1568ad2c08699843 /ssl/quic/quic_rx_depack.c
parent0911cb4a072f55b5f982635faeaa7a992a14181f (diff)
QUIC CONFORMANCE: Enforce minimal frame type encoding
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21135)
Diffstat (limited to 'ssl/quic/quic_rx_depack.c')
-rw-r--r--ssl/quic/quic_rx_depack.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/ssl/quic/quic_rx_depack.c b/ssl/quic/quic_rx_depack.c
index 88a893cf24..6e2067f451 100644
--- a/ssl/quic/quic_rx_depack.c
+++ b/ssl/quic/quic_rx_depack.c
@@ -928,6 +928,7 @@ static int depack_process_frames(QUIC_CHANNEL *ch, PACKET *pkt,
}
while (PACKET_remaining(pkt) > 0) {
+ int was_minimal;
uint64_t frame_type;
const unsigned char *sof = NULL;
uint64_t datalen = 0;
@@ -935,8 +936,21 @@ static int depack_process_frames(QUIC_CHANNEL *ch, PACKET *pkt,
if (ch->msg_callback != NULL)
sof = PACKET_data(pkt);
- if (!ossl_quic_wire_peek_frame_header(pkt, &frame_type))
+ if (!ossl_quic_wire_peek_frame_header(pkt, &frame_type, &was_minimal)) {
+ ossl_quic_channel_raise_protocol_error(ch,
+ QUIC_ERR_PROTOCOL_VIOLATION,
+ 0,
+ "malformed frame header");
+ return 0;
+ }
+
+ if (!was_minimal) {
+ ossl_quic_channel_raise_protocol_error(ch,
+ QUIC_ERR_PROTOCOL_VIOLATION,
+ frame_type,
+ "non-minimal frame type encoding");
return 0;
+ }
switch (frame_type) {
case OSSL_QUIC_FRAME_TYPE_PING:
@@ -1211,7 +1225,7 @@ static int depack_process_frames(QUIC_CHANNEL *ch, PACKET *pkt,
/* Unknown frame type */
ackm_data->is_ack_eliciting = 1;
ossl_quic_channel_raise_protocol_error(ch,
- QUIC_ERR_PROTOCOL_VIOLATION,
+ QUIC_ERR_FRAME_ENCODING_ERROR,
frame_type,
"Unknown frame type received");
return 0;