]> git.kaiwu.me - nginx.git/commitdiff
QUIC: ngx_quic_buffer_t use-after-free protection.
authorRoman Arutyunyan <arut@nginx.com>
Tue, 28 May 2024 13:19:21 +0000 (17:19 +0400)
committerRoman Arutyunyan <arut@nginx.com>
Tue, 28 May 2024 13:19:21 +0000 (17:19 +0400)
Previously the last chain field of ngx_quic_buffer_t could still reference freed
chains and buffers after calling ngx_quic_free_buffer().  While normally an
ngx_quic_buffer_t object should not be used after freeing, resetting last_chain
field would prevent a potential use-after-free.

src/event/quic/ngx_event_quic_frames.c

index 42b7d9f41de4f8f63f55dc8d5d0abbdd2011d050..6ea908cc1ca27135829804d7b75e749e2b3e4173 100644 (file)
@@ -648,6 +648,7 @@ ngx_quic_free_buffer(ngx_connection_t *c, ngx_quic_buffer_t *qb)
     ngx_quic_free_chain(c, qb->chain);
 
     qb->chain = NULL;
+    qb->last_chain = NULL;
 }