QUIC CONFORMANCE: RFC 9000 s. 19.7
authorHugo Landau <hlandau@openssl.org>
Tue, 6 Jun 2023 15:25:11 +0000 (16:25 +0100)
committerPauli <pauli@openssl.org>
Sun, 16 Jul 2023 22:17:57 +0000 (08:17 +1000)
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)

ssl/quic/quic_rx_depack.c

index c75363d03878ac3a376321e0e27d63ff267a8a24..aa107455078bf5946733fef711b53d2729cacdb7 100644 (file)
@@ -314,6 +314,19 @@ static int depack_do_frame_new_token(PACKET *pkt, QUIC_CHANNEL *ch,
     /* This frame makes the packet ACK eliciting */
     ackm_data->is_ack_eliciting = 1;
 
+    if (token_len == 0) {
+        /*
+         * RFC 9000 s. 19.7: "A client MUST treat receipt of a NEW_TOKEN frame
+         * with an empty Token field as a connection error of type
+         * FRAME_ENCODING_ERROR."
+         */
+        ossl_quic_channel_raise_protocol_error(ch,
+                                               QUIC_ERR_FRAME_ENCODING_ERROR,
+                                               OSSL_QUIC_FRAME_TYPE_NEW_TOKEN,
+                                               "zero-length NEW_TOKEN");
+        return 0;
+    }
+
     /* TODO(QUIC): ADD CODE to send |token| to the session manager */
 
     return 1;