# HG changeset patch # User Sergey Kandaurov # Date 1584144909 -10800 # Node ID 33feac1e57ac58578afbb3fa2f476c7597158263 # Parent a5a1b3fad83485b70b4429cf442aa9f6c6148a2d Fixed header protection application with pn length > 1. diff --git a/src/event/ngx_event_quic.c b/src/event/ngx_event_quic.c --- 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, ng 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;