[PATCH] Core: ngx_palloc after alignment boundary check
tolga ceylan
tolga.ceylan at gmail.com
Tue Mar 8 23:13:35 UTC 2016
# HG changeset patch
# User Tolga Ceylan <tolga.ceylan at gmail.com>
# Date 1457477267 28800
# Tue Mar 08 14:47:47 2016 -0800
# Node ID 44c90f64f3eec25cdf2e5bee13419cb71e9cdf93
# Parent c5f81dcf97a79576138917501c9a6cc6f53ee930
Core: ngx_palloc after alignment boundary check
Alignment macro can move the current pointer beyond
the current pool boundary. Additional check is needed
to ensure within range.
diff -r c5f81dcf97a7 -r 44c90f64f3ee src/core/ngx_palloc.c
--- a/src/core/ngx_palloc.c Thu Mar 03 21:14:19 2016 +0300
+++ b/src/core/ngx_palloc.c Tue Mar 08 14:47:47 2016 -0800
@@ -129,7 +129,7 @@
do {
m = ngx_align_ptr(p->d.last, NGX_ALIGNMENT);
- if ((size_t) (p->d.end - m) >= size) {
+ if (m < p->d.end && (size_t) (p->d.end - m) >= size) {
p->d.last = m + size;
return m;
More information about the nginx-devel
mailing list