summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2022-10-31 15:48:18 +0000
committerHugo Landau <hlandau@openssl.org>2023-01-13 13:20:12 +0000
commit6946f1184aa4b0e42cc9c502115bf6c5dd72fa90 (patch)
tree11c6a7c902c7cecae472855bd5141c7c7067332c
parent21247795c0c981299efd02bd1dc0034e4c008f67 (diff)
QUIC Wire Format Encoding: Fix handling of zero-length parameters
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19703)
-rw-r--r--ssl/quic/quic_wire.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ssl/quic/quic_wire.c b/ssl/quic/quic_wire.c
index bc66f6c592..8bd1057d0d 100644
--- a/ssl/quic/quic_wire.c
+++ b/ssl/quic/quic_wire.c
@@ -382,8 +382,12 @@ unsigned char *ossl_quic_wire_encode_transport_param_bytes(WPACKET *pkt,
unsigned char *b = NULL;
if (!WPACKET_quic_write_vlint(pkt, id)
- || !WPACKET_quic_write_vlint(pkt, value_len)
- || !WPACKET_allocate_bytes(pkt, value_len, (unsigned char **)&b))
+ || !WPACKET_quic_write_vlint(pkt, value_len))
+ return NULL;
+
+ if (value_len == 0)
+ b = WPACKET_get_curr(pkt);
+ else if (!WPACKET_allocate_bytes(pkt, value_len, (unsigned char **)&b))
return NULL;
if (value != NULL)