aboutsummaryrefslogtreecommitdiff
path: root/src/http/v3/ngx_http_v3_module.c
diff options
context:
space:
mode:
authorVladimir Homutov <vl@nginx.com>2020-04-16 12:17:41 +0300
committerVladimir Homutov <vl@nginx.com>2020-04-16 12:17:41 +0300
commitf901747f29e0c9c65db06ae522469ad5d916611e (patch)
tree5bfccd0946fdf046187d1e922c0891c87050befa /src/http/v3/ngx_http_v3_module.c
parentdf01c0c13c0080986cf26222ba929d41eb47c286 (diff)
downloadnginx-f901747f29e0c9c65db06ae522469ad5d916611e.tar.gz
nginx-f901747f29e0c9c65db06ae522469ad5d916611e.zip
Added handling of incorrect values in TP configuration.
Some parameters have minimal/maximum values defined by standard.
Diffstat (limited to 'src/http/v3/ngx_http_v3_module.c')
-rw-r--r--src/http/v3/ngx_http_v3_module.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/src/http/v3/ngx_http_v3_module.c b/src/http/v3/ngx_http_v3_module.c
index 4306206c9..4b5f2f370 100644
--- a/src/http/v3/ngx_http_v3_module.c
+++ b/src/http/v3/ngx_http_v3_module.c
@@ -255,16 +255,30 @@ ngx_http_v3_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_conf_merge_msec_value(conf->quic.max_idle_timeout,
prev->quic.max_idle_timeout, 60000);
- // > 2 ^ 14 is invalid
ngx_conf_merge_msec_value(conf->quic.max_ack_delay,
prev->quic.max_ack_delay,
NGX_QUIC_DEFAULT_MAX_ACK_DELAY);
- // < 1200 is invalid
+ if (conf->quic.max_ack_delay > 16384) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "\"quic_max_ack_delay\" greater than"
+ " 16384 is invalid");
+ return NGX_CONF_ERROR;
+ }
+
ngx_conf_merge_uint_value(conf->quic.max_packet_size,
prev->quic.max_packet_size,
NGX_QUIC_DEFAULT_MAX_PACKET_SIZE);
+ if (conf->quic.max_packet_size < 1200
+ || conf->quic.max_packet_size > 65527)
+ {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "\"quic_max_packet_size\" less than"
+ " 1200 or greater than 65527 is invalid");
+ return NGX_CONF_ERROR;
+ }
+
ngx_conf_merge_uint_value(conf->quic.initial_max_data,
prev->quic.initial_max_data,
16 * NGX_QUIC_STREAM_BUFSIZE);
@@ -287,18 +301,30 @@ ngx_http_v3_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_conf_merge_uint_value(conf->quic.initial_max_streams_uni,
prev->quic.initial_max_streams_uni, 16);
- // > 20 is invalid
ngx_conf_merge_uint_value(conf->quic.ack_delay_exponent,
prev->quic.ack_delay_exponent,
NGX_QUIC_DEFAULT_ACK_DELAY_EXPONENT);
+ if (conf->quic.ack_delay_exponent > 20) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "\"quic_ack_delay_exponent\" greater than"
+ " 20 is invalid");
+ return NGX_CONF_ERROR;
+ }
+
ngx_conf_merge_uint_value(conf->quic.disable_active_migration,
prev->quic.disable_active_migration, 1);
- // < 2 is invalid
ngx_conf_merge_uint_value(conf->quic.active_connection_id_limit,
prev->quic.active_connection_id_limit, 2);
+ if (conf->quic.active_connection_id_limit < 2) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "\"quic_active_connection_id_limit\" less than"
+ " 2 is invalid");
+ return NGX_CONF_ERROR;
+ }
+
return NGX_CONF_OK;
}