Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19703)
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)