aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoman Arutyunyan <arut@nginx.com>2020-05-19 15:41:41 +0300
committerRoman Arutyunyan <arut@nginx.com>2020-05-19 15:41:41 +0300
commit1c54340e0aa65781f6cd4cc643f704826c47459a (patch)
tree4eec4f5cb7605e28600eef48c7d01fda9af0558d /src
parente0eb261b833dd544adc17d6d810a68c5bd8e6f0c (diff)
downloadnginx-1c54340e0aa65781f6cd4cc643f704826c47459a.tar.gz
nginx-1c54340e0aa65781f6cd4cc643f704826c47459a.zip
HTTP/3: prevent array access by negative index for unknown streams.
Currently there are no such streams, but the function ngx_http_v3_get_uni_stream() supports them.
Diffstat (limited to 'src')
-rw-r--r--src/http/v3/ngx_http_v3_streams.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/http/v3/ngx_http_v3_streams.c b/src/http/v3/ngx_http_v3_streams.c
index 165f21fdc..bd4583998 100644
--- a/src/http/v3/ngx_http_v3_streams.c
+++ b/src/http/v3/ngx_http_v3_streams.c
@@ -320,7 +320,9 @@ ngx_http_v3_get_uni_stream(ngx_connection_t *c, ngx_uint_t type)
sc->read->handler = ngx_http_v3_uni_read_handler;
sc->write->handler = ngx_http_v3_dummy_write_handler;
- h3c->known_streams[index] = sc;
+ if (index >= 0) {
+ h3c->known_streams[index] = sc;
+ }
n = (u_char *) ngx_http_v3_encode_varlen_int(buf, type) - buf;