From: Sergey Kandaurov Date: Sat, 14 Mar 2020 00:15:09 +0000 (+0300) Subject: Fixed header protection application with pn length > 1. X-Git-Tag: release-1.25.0~4^2~891 X-Git-Url: http://www.kaiwu.me/postgresql/commit/static/gitweb.js?a=commitdiff_plain;h=1ac31c01b4a2df79a512a7b6bde67002b3e5259e;p=nginx.git Fixed header protection application with pn length > 1. --- diff --git a/src/event/ngx_event_quic.c b/src/event/ngx_event_quic.c index 7819e3f51..199284162 100644 --- a/src/event/ngx_event_quic.c +++ b/src/event/ngx_event_quic.c @@ -1637,7 +1637,10 @@ ngx_quic_decrypt(ngx_connection_t *c, ngx_quic_header_t *pkt) ngx_memcpy(ad.data, pkt->data, ad.len); ad.data[0] = clearflags; - ad.data[ad.len - pnl] = (u_char) pn; + + do { + ad.data[ad.len - pnl] = pn >> (8 * (pnl - 1)) % 256; + } while (--pnl); nonce = ngx_pstrdup(c->pool, &pkt->secret->iv); nonce[11] ^= pn;