mirror of
https://github.com/nginx/nginx.git
synced 2025-02-25 18:55:26 -06:00
QUIC: do not update largest packet number from a bad packet.
The removal of QUIC packet protection depends on the largest packet number received. When a garbage packet was received, the decoder still updated the largest packet number from that packet. This could affect removing protection from subsequent QUIC packets.
This commit is contained in:
parent
6f0e1bc14f
commit
2087359675
@ -998,7 +998,7 @@ ngx_quic_decrypt(ngx_quic_header_t *pkt, ngx_ssl_conn_t *ssl_conn,
|
||||
{
|
||||
u_char clearflags, *p, *sample;
|
||||
uint8_t badflags;
|
||||
uint64_t pn;
|
||||
uint64_t pn, lpn;
|
||||
ngx_int_t pnl, rc, key_phase;
|
||||
ngx_str_t in, ad;
|
||||
ngx_quic_secret_t *secret;
|
||||
@ -1043,8 +1043,10 @@ ngx_quic_decrypt(ngx_quic_header_t *pkt, ngx_ssl_conn_t *ssl_conn,
|
||||
}
|
||||
}
|
||||
|
||||
lpn = *largest_pn;
|
||||
|
||||
pnl = (clearflags & 0x03) + 1;
|
||||
pn = ngx_quic_parse_pn(&p, pnl, &mask[1], largest_pn);
|
||||
pn = ngx_quic_parse_pn(&p, pnl, &mask[1], &lpn);
|
||||
|
||||
pkt->pn = pn;
|
||||
pkt->flags = clearflags;
|
||||
@ -1118,6 +1120,8 @@ ngx_quic_decrypt(ngx_quic_header_t *pkt, ngx_ssl_conn_t *ssl_conn,
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
*largest_pn = lpn;
|
||||
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user