Mercurial > hg > nginx
diff src/event/ngx_event_quic_transport.h @ 8240:1f002206a59b quic
Added boundaries checks into frame parser.
The ngx_quic_parse_frame() functions now has new 'pkt' argument: the packet
header of a currently processed frame. This allows to log errors/debug
closer to reasons and perform additional checks regarding possible frame
types. The handler only performs processing of good frames.
A number of functions like read_uint32(), parse_int[_multi] probably should
be implemented as a macro, but currently it is better to have them as
functions for simpler debugging.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Thu, 19 Mar 2020 17:07:12 +0300 |
parents | ff540f13d95d |
children | db745339e54b |
line wrap: on
line diff
--- a/src/event/ngx_event_quic_transport.h +++ b/src/event/ngx_event_quic_transport.h @@ -82,8 +82,8 @@ typedef struct { typedef struct { - size_t offset; - size_t len; + uint64_t offset; + uint64_t len; u_char *data; } ngx_quic_crypto_frame_t; @@ -91,7 +91,7 @@ typedef struct { typedef struct { uint64_t seqnum; uint64_t retire; - uint64_t len; + uint8_t len; u_char cid[20]; u_char srt[16]; } ngx_quic_new_conn_id_frame_t; @@ -166,8 +166,8 @@ typedef struct { struct ngx_quic_secret_s *secret; ngx_uint_t type; - ngx_uint_t *number; - ngx_uint_t flags; + ngx_uint_t *number; + uint8_t flags; uint32_t version; ngx_str_t token; enum ssl_encryption_level_t level; @@ -197,7 +197,7 @@ ngx_int_t ngx_quic_parse_short_header(ng ngx_int_t ngx_quic_parse_initial_header(ngx_quic_header_t *pkt); ngx_int_t ngx_quic_parse_handshake_header(ngx_quic_header_t *pkt); -ssize_t ngx_quic_parse_frame(u_char *start, u_char *end, +ssize_t ngx_quic_parse_frame(ngx_quic_header_t *pkt, u_char *start, u_char *end, ngx_quic_frame_t *frame); ssize_t ngx_quic_create_frame(u_char *p, u_char *end, ngx_quic_frame_t *f); size_t ngx_quic_frame_len(ngx_quic_frame_t *frame);