mirror of
https://gitea.invidious.io/iv-org/litespeed-quic.git
synced 2024-08-15 00:53:43 +00:00
Fix function that checks validity of handshake packets
When Initial and 0-RTT packets are coalesced, they can be 1200 *together*. lsquic_is_valid_hs_packet() should use the datagram
This commit is contained in:
parent
6eec0a76f7
commit
e0a487cf6e
2 changed files with 5 additions and 4 deletions
|
@ -1675,7 +1675,8 @@ lsquic_get_h3_alpns (unsigned versions);
|
|||
* been established: it will return incorrect result.
|
||||
*/
|
||||
int
|
||||
lsquic_is_valid_hs_packet (lsquic_engine_t *, const unsigned char *, size_t);
|
||||
lsquic_is_valid_hs_packet (lsquic_engine_t *, const unsigned char *,
|
||||
size_t bufsz, size_t packet_in_sz);
|
||||
|
||||
/**
|
||||
* Parse cid from packet stored in `buf' and store it to `cid'. Returns 0
|
||||
|
|
|
@ -88,7 +88,7 @@ is_valid_gquic_hs_packet (const unsigned char *buf, size_t bufsz,
|
|||
|
||||
int
|
||||
lsquic_is_valid_hs_packet (struct lsquic_engine *engine,
|
||||
const unsigned char *buf, size_t bufsz)
|
||||
const unsigned char *buf, size_t bufsz, size_t packet_in_sz)
|
||||
{
|
||||
lsquic_ver_tag_t tag;
|
||||
int is_valid;
|
||||
|
@ -104,7 +104,7 @@ lsquic_is_valid_hs_packet (struct lsquic_engine *engine,
|
|||
case 0x80|0x00|0x20|0x10|0x08:
|
||||
case 0x80|0x40|0x20|0x10|0x00:
|
||||
case 0x80|0x00|0x20|0x10|0x00:
|
||||
is_valid = bufsz >= IQUIC_MIN_INIT_PACKET_SZ
|
||||
is_valid = packet_in_sz >= IQUIC_MIN_INIT_PACKET_SZ
|
||||
&& lsquic_is_valid_iquic_hs_packet(buf, bufsz, &tag);
|
||||
break;
|
||||
/* 1X00 XGGG: ID-22 long header */
|
||||
|
@ -122,7 +122,7 @@ lsquic_is_valid_hs_packet (struct lsquic_engine *engine,
|
|||
case 0x80|0x00|0x20|0x00|0x08:
|
||||
case 0x80|0x40|0x20|0x00|0x00:
|
||||
case 0x80|0x00|0x20|0x00|0x00:
|
||||
is_valid = bufsz >= IQUIC_MIN_INIT_PACKET_SZ
|
||||
is_valid = packet_in_sz >= IQUIC_MIN_INIT_PACKET_SZ
|
||||
&& lsquic_is_valid_ietf_v1_or_Q046plus_hs_packet(buf, bufsz, &tag);
|
||||
break;
|
||||
/* 01XX XGGG: ID-22 short header */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue