1
0
mirror of https://github.com/moparisthebest/curl synced 2025-01-10 21:48:10 -05:00

ngtcp2: Fix stack buffer overflow

Closes #6521
This commit is contained in:
Tatsuhiro Tsujikawa 2021-01-25 18:39:00 +09:00 committed by Daniel Stenberg
parent ad1c7154b3
commit a1338d4297
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -1334,13 +1334,14 @@ static ssize_t cb_h3_readfunction(nghttp3_conn *conn, int64_t stream_id,
nread = H3_SEND_SIZE - out->windex;
memcpy(&out->buf[out->windex], stream->upload_mem, nread);
out->windex += nread;
out->used += nread;
/* that's the chunk we return to nghttp3 */
vec[0].base = &out->buf[out->windex];
vec[0].len = nread;
out->windex += nread;
out->used += nread;
if(out->windex == H3_SEND_SIZE)
out->windex = 0; /* wrap */
stream->upload_mem += nread;